安装express报错

我就是我 2022-09-07 12:07 339阅读 0赞

安装express报错

  1. npm install express --save

报错信息:

  1. npm ERR! code ENOSELF
  2. npm ERR! Refusing to install package with name "express" under a package
  3. npm ERR! also called "express". Did you name your project the same
  4. npm ERR! as the dependency you're installing?
  5. npm ERR!
  6. npm ERR! For more information, see:
  7. npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
  8. npm ERR! A complete log of this run can be found in:
  9. npm ERR! C:\Users\16273\AppData\Roaming\npm-cache\_logs\2021-08-23T02_52_46_049Z-debug.log

看了很多解决方法
尝试用管理员身份运行cmd 全局安装 在npm install 没作用

最终发现是命名冲突了

  1. package.json里有个name 命名 express相同 导致安装失败;
  2. 修改为node-express后安装成功

在这里插入图片描述

ps: 因为我这里是做demo择机学习用的,命名都是默认,所以正正常公司项目不会遇到这些问题

发表评论

表情:
评论列表 (有 0 条评论,339人围观)

还没有评论,来说两句吧...

相关阅读