【发布时间】:2020-03-04 16:37:47
【问题描述】:
问题是,当我执行 npm start 或 npm run customScriptCommand 时,npm 只是没有对项目做任何事情,而是快速在终端中返回新行。
我尝试从我的机器中删除 node 和 npm,然后为 node 和 npm 进行 brew 安装,但它并没有解决问题。
然后我尝试从 brew 安装中删除 node 和 npm 并从 nvm 再次安装它,但它也没有解决问题。
NPM 详情
npm -v -> 6.11.3
which npm -> /usr/local/bin/npm
NodeJS 详情
node -v -> v12.12.0
which node ->/usr/local/bin/node
package.json 中的脚本
"scripts": {
"start": "node ./bin/www",
"devstart": "DEBUG=app-name:* nodemon ./bin/www", //I've changed my actual app name to "app-name"
},
如果我这样做 node ./bin/www 或 DEBUG=app-name:* nodemon ./bin/www 它将起作用:
更新
我在同事的机器上尝试过其他没有问题的项目,
git clone做npm install并尝试运行该项目,但仍然失败即使是我刚刚完成的新项目
npm init -y也失败了,
{
"name": "test"
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "itsme",
"license": "ISC"
}
【问题讨论】:
-
你能发布你的整个 package.json 吗?您显示的位看起来正确。
-
即使有了我刚刚做的新项目
npm init,它仍然失败了。 ``` mkdir test cd test && npm init -y ``` 结果 package.json: `` { "name": "test", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "nrajan" ,“许可证”:“ISC”}```
标签: javascript node.js npm npm-scripts