我有一个NPM的问题。最近,每当我尝试使用npm运行脚本时,它会给我一堵整墙的错误信息,即使我知道这些脚本是正确的,我也无法弄清原因...
package.json
{
"name": "testing",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
您可以看到,这只是在运行npm init
并按下几次回车后生成的...但是当我运行npm run test
时,我会得到以下结果...
> testing@1.0.0 test C:\Users\user\Desktop\testing
> echo "Error: no test specified" && exit 1
"Error: no test specified"
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
npm ERR! node v7.4.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! testing@1.0.0 test: `echo "Error: no test specified" && exit 1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testing@1.0.0 test script 'echo "Error: no test specified" && exit 1'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the testing package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! echo "Error: no test specified" && exit 1
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs testing
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls testing
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\Desktop\testing\npm-debug.log
正如您在错误信息中看到的那样,我使用的是node v7.4.0和npm v4.1.2... 之前我使用的是node v6.9.2,但在遇到此错误后我已经更新了版本,但仍然没有改变... 另外我不知道这是否有很大影响,但我正在运行windows 10。我已经尝试过npm cache clear
解决方案,但对我没有用。