npm脚本无法调用npm,node,gulp或任何全局安装的包

时间:2018-05-19 13:29:06

标签: node.js npm

我的NPM安装似乎有问题。我在Windows 10上,我有npm v6.0.0

请参阅此示例package.json文件的脚本:

"nodev": "node -v",
"npmv": "npm -v"
"gulpv": "gulp -v",
"gulp2v": "./node_modules/gulp/bin/gulp.js -v"

以下是运行上述内容的输出:

npm run nodev'node' is not recognized as an internal or external command

npm run npmv'npm' is not recognized as an internal or external command

npm run gulpv'node' is not recognized as an internal or external command

npm run gulp2v'.' is not recognized as an internal or external command

现在,如果我在不经过npm的情况下运行命令:

node -vv10.0.0

npm -v6.0.0

gulp -v[22:55:15] CLI version 1.2.1 (\n) [22:55:15] Local version 3.9.1

./node_modules/gulp/bin/gulp.js -v[22:55:56] CLI version 3.9.1 (\n) [22:55:56] Local version 3.9.1

我的PATH环境变量设置正确,因为我可以在不通过NPM脚本的情况下运行命令。

我无法弄清楚为什么使用NPM脚本运行完全相同的命令导致问题?

0 个答案:

没有答案