目录
npm-start
启动一个包
选择 CLI 版本
目录
概要
npm start [-- <args>]
描述
这将运行在包的 "scripts" 对象的 "start" 属性中指定的预定义命令。
如果 "scripts" 对象没有定义 "start" 属性,npm 将运行 node server.js。
注意,这与使用 node . 调用时运行包的 "main" 属性中指定的默认节点行为不同。
从 npm@2.0.0 开始,您可以在执行脚本时使用自定义参数。有关更多详细信息,请参阅 npm run-script。
示例
{"scripts": {"start": "node foo.js"}}
npm start> npm@x.x.x start> node foo.js(foo.js output would be here)
配置
ignore-scripts
- 默认值:false
- 类型:布尔值
如果为 true,npm 不会运行 package.json 文件中指定的脚本。
注意,明确旨在运行特定脚本的命令(例如 npm start、npm stop、npm restart、npm test 和 npm run-script)如果设置了 ignore-scripts 仍然会运行其目标脚本,但它们不会运行任何预脚本或后脚本。
script-shell
- 默认值:POSIX 系统上的 '/bin/sh',Windows 上的 'cmd.exe'
- 类型:null 或字符串
用于使用 npm exec、npm run 和 npm init <package-spec> 命令运行的脚本的 shell。