npm報錯:A complete log of this run can be fund in: cache_logs 解決方案
項目運行出現如下錯誤:
PS D:\SoftData\WebstormProjects\vue2\vue-cms> npm start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! d:\Program Files\nodejs\node_cache\_logs\2020-03-08T23_03_16_099Z-debug.log
解決方法:
- 首先確定出現問題的原因,覈對是否因爲包未完整下載
- 再覈對
package.json
中配置的腳本命令
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --mode development --open --port 3000 --hot --disableHostCheck"
}
包未完整下載
- 刪除原始
node_modules
文件夾先刪除 - 清理緩存
npm cache clean --force
- 重新安裝
npm i
問題解決
未包含所使用的腳本命令
- 腳本中只存在
test
、dev
命令 - 使用
npm run 命令
時,只能使用npm run dev
或npm run test
,使用npm run start
會報錯
一定要確保只能使用package.json
中配置的腳本命令