我无法让npm工作。我的package.json文件有
"scripts": { "build": "build.js" }
我在与console.logs相同的文件夹中有一个build.js文件。
当我跑步
npm run build
我得到错误
The system cannot execute the specified program. npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" npm ERR! node v4.1.1 npm ERR! npm v3.3.5 npm ERR! code ELIFECYCLE
如果我移动build.js文件并更改package.json文件以包含一个子文件夹
"scripts": { "build": "build/build.js" }
然后我得到错误
'build' is not recognized as an internal or external command, operable program or batch file.
怎么了 我正在复制示例文档。
{ "scripts" : { "build": "node build.js"} }
npm run build 要么 npm run-script build
npm run-script build
{ "name": "build", "version": "1.0.0", "scripts": { "start": "node build.js" } }
npm start
注意: 您缺少{ brackets }和节点命令
{ brackets }
文件夹结构很好:
+ build - package.json - build.js