此错误是在执行命令npm run watch时发生的,我试图用不同的策略来解决它,但找不到任何解决方法
我尝试解决此问题的步骤
1)删除节点模块,package-lock.json,yarn.lock npm缓存清除并运行npm安装,但仍然发生错误。
2)从控制面板中删除nodejs,然后使用最新版本(然后是旧/旧版本)进行重新安装,然后重新安装但无法成功,仍然会发生错误。
npm错误!代码MODULE_NOT_FOUND npm ERR!找不到模块 'spdx-expression-parse'
npm错误!有关此运行的完整日志,请参见:npm ERR!
C:\ Users \ DELL \ AppData \ Roaming \ npm-cache_logs \ 2018-12-20T08_00_01_749Z-debug.log
日志文件
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm@6.5.0
3 info using node@v8.12.0
4 verbose stack Error: Cannot find module 'spdx-expression-parse'
4 verbose stack at Function.Module._resolveFilename (module.js:548:15)
4 verbose stack at Function.Module._load (module.js:475:25)
4 verbose stack at Module.require (module.js:597:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object.<anonymous> (C:\Users\DELL\AppData\Roaming\npm\node_modules\npm\node_modules\validate-npm-package-license\index.js:1:75)
4 verbose stack at Module._compile (module.js:653:30)
4 verbose stack at Object.Module._extensions..js (module.js:664:10)
4 verbose stack at Module.load (module.js:566:32)
4 verbose stack at tryModuleLoad (module.js:506:12)
4 verbose stack at Function.Module._load (module.js:498:3)
5 verbose cwd D:\it-88-lynx
6 verbose Windows_NT 10.0.17134
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
8 verbose node v8.12.0
9 verbose npm v6.5.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'spdx-expression-parse'
12 verbose exit [ 1, true ]
答案 0 :(得分:0)
最后,我已经解决了问题,位于users/AppData/Roaming/npm/node_modules/
上的spdx-expression-parse已损坏
remove node_modules
uninstall nodejs
(开始主要步骤)
Go to users/AppData/Roaming and delete npm and npm-cache folders manually
(结束主要步骤)
然后运行以下命令
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
感谢您的支持。