由于之前使用的是node.js的16.5版本且npm版本为7,npm7比npm6在一些方面要求苛刻,运行npm install一直报错。

解决办法:node.js版本换成14版本,具体方法如下。

查看npm版本:npm -v


npm WARN using --force Recommended protections disabled.
npm ERR! code EUSAGE
npm ERR! npm cache  
npm ERR! 
npm ERR! Manipulates packages cache
npm ERR! 
npm ERR! Usage:
npm ERR! npm cache add <folder>
npm ERR! npm cache add <tarball url>
npm ERR! npm cache add <git url>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache clean
npm ERR! npm cache verify
npm ERR!
npm ERR! Run "npm help cache" for more info

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mr\AppData\Local\npm-cache\_logs\2021-05-01T03_13_10_382Z-debug.log
PS F:\devops_common\cloud-vue> npm cache
npm ERR! code EUSAGE
npm ERR! npm cache
npm ERR!
npm ERR! Manipulates packages cache
npm ERR!
npm ERR! Usage:
npm ERR! npm cache add <folder>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache clean
npm ERR! npm cache verify
npm ERR!
npm ERR! Run "npm help cache" for more info

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mr\AppData\Local\npm-cache\_logs\2021-05-01T03_13_18_530Z-debug.log
PS F:\devops_common\cloud-vue> npm cache clean -f
npm WARN using --force Recommended protections disabled.
PS F:\devops_common\cloud-vue>
PS F:\devops_common\cloud-vue> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cloud-ui@1.0.0
npm ERR! Found: less@2.7.3
npm ERR! node_modules/less
npm ERR!   less@"^2.7.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer less@"^3.5.0 || ^4.0.0" from less-loader@7.3.0
npm ERR!   less-loader@"^7.3.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR!
npm ERR! See C:\Users\Mr\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mr\AppData\Local\npm-cache\_logs\2021-05-01T03_14_21_801Z-debug.log

解决方法:

降级npm到6版本,最直接的办法就是把node.js版本换成node.js的14版本

查看npm版本:npm -v

查看node.js版本: node --version

下载地址:下载 | Node.js 中文网

结果:

运行正常

 npm run dev运行正常

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐