NPM初始化

  1. 1.1 NPM初始化项目

1.1 NPM初始化项目

  • npm init 初始化项目
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    # 创建目录
    $ mkdir -p npm/demo
    # 进入刚才创建的目录
    $ cd !$
    # 交互式初始化项目
    $ npm init
    This utility will walk you through creating a package.json file.
    It only covers the most common items, and tries to guess sensible defaults.

    See `npm help json` for definitive documentation on these fields
    and exactly what they do.

    Use `npm install <pkg>` afterwards to install a package and
    save it as a dependency in the package.json file.

    Press ^C at any time to quit. <= 下面"()"内为默认值,如需修改直接键入值即可
    package name: (demo) <= 这是输入当前项目名称,默认为当前目录名称,不能用大写可以用"-"
    version: (1.0.0) <= 当前项目的版本号
    description: MyFirstDemo <= 简单描述
    entry point: (index.js) <= 项目的入口文件,就好比静态网站的index.html
    test command:
    git repository: <= 这里可以写git仓库地址用于上传
    keywords:
    author: <= 这里可以输入坐着名称
    license: (ISC) <= 许可证类型
    About to write to /Users/aron/npm/demo/package.json:

    {
    "name": "demo",
    "version": "1.0.0",
    "description": "MyFirstDemo",
    "main": "index.js",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "ISC"
    }


    Is this OK? (yes) yes <=这里输入"yes"

    $ ls
    package.json
  • 自动初始化项目,均为默认值
    1
    npm init -y

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 jaytp@qq.com

文章标题:NPM初始化

文章字数:306

本文作者:Aaron

发布时间:2019-11-25, 22:45:24

最后更新:2019-11-30, 11:08:29

原始链接:http://blog.linuxerbulo.com/2019/11/25/NPM%E5%88%9D%E5%A7%8B%E5%8C%96/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏