Refusing to install package with name “XXXX”
我的执行步骤
我创建了一个名叫express的文件夹,想在这个工程中学习express
进入该文件夹,执行npm init来初始化package.json文件,一直回车。

我们会发现当前文件夹多了一个 package.json 文件。
然后安装express包并保存在package.json的依赖中
npm install express --save
出现错误:
10:04:53 @~/code/express$ npm install express --save
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "express" under a package
npm ERR! also called "express". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
问题原因
可以确定我平常使用npm 安装依赖包的时候,是没有问题的。
我又看了一下package.json文件,发现我在初始化的时候name字段为express。怀疑是这个问题。

然后我将name字段的值修改为express-test

然后重新执行
npm install express --save
成功后出现:

然后我们再看一下package.json文件:

发现多了一个dependencies字段,里面保存了express的名称及版本
然后在文件夹内输入ls,多了个node_modules文件夹

总结
npm install xxxx --save命令会将安装包的名字及版本保存在package.json文件中
package.json文件中的name字段的值,不能与所要安装的依赖包名字相同。
Refusing to install package with name “XXXX”的更多相关文章
- npm安装报错npm ERR! Refusing to install package with name "xxxx" under a packagexxxx
npm ERR! code ENOSELF npm ERR! Refusing to install package with name "webpack" under a pac ...
- Node Newbie Error – NPM Refusing to Install Package as a Dependency of Itself
46 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_ ...
- vue 安装插件Refusing to install package with name '???'
今天想练习使用下vux框架,安装时报错 查了下,创建项目时描述都是一样的,去package.json把name改成其它就得了
- npm ERR! Refusing to install package with name "webpack" under a package -----
当我们在安装以一些依赖的时候会提示以下报错--------- 问题出在: 这个name 不能使用所需要安装包的名字! 解决方案----- 修改下就行 -- -我将wenpack 改成webpack1 ...
- Refusing to install package with name "webpack" under a package
最近学习webpack 知识时 下载依赖结果报了这个错 查阅资料后发现是 这个name 不能使用所需要安装包的名字! 换为其他之后 再次操作命令 就没问题了
- Refusing to install webpack as a dependency of itself
用npm安装webpack的时候报了这个错: Refusing to install webpack as a dependency of itself 翻译过来大概是:'拒绝安装webpack其本身 ...
- npm WARN install Refusing to install vue-router as a dependency of itself
今天在使用npm安装插件的时候提示如下错误: npm WARN install Refusing to install vue-router as a dependency of itself npm ...
- res\menu\main.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.xxx.xxxx'
res\menu\main.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'co ...
- sublime 快速安装多个插件的两种方法[Advanced Install Package]与[Package Control.sublime-settings]
环境 sublime 3,目前官网下载的sublime3 已经支持自动安装 Package Control . 第一种: ctrl+shift+p 调出命令面板以后 以前都是使用 Package Co ...
随机推荐
- mfc对话框嵌入Flash的交互(转)
原文转自 http://blog.csdn.net/yacper/article/details/5021081 研究Flash嵌入游戏中的可行性....... 渲染问题已解决 事件响应已解决 下面是 ...
- VUE之命令行报错:Expected indentation of 4 spaces but found 6
使用vue时候,经常被一大片警告惊呆了,这是webpack默认的语法检查插件ESLint在做警告, [ESLint是一个语法规则和代码风格的检查工具,可以用来保证写出语法正确.风格统一的代码] 但是我 ...
- [Python Cookbook] Numpy Array Manipulation
1. Reshape: The np.reshape() method will give a new shape to an array without changing its data. Not ...
- netframework中等待多个子线程执行完毕并计算执行时间
本文主要描述在.netframework中(实验环境.netframework版本为4.6.1)提供两种方式等待多个子线程执行完毕. ManualResetEvent 在多线程中,将ManualRes ...
- shell细节决定高度
1.文件测试操作符 -f[file]:文件存在且为普通文件则为真; -d[directory]:文件存在且为目录文件则为真; -s[size]:文件存在且为文件大小不为0则为真; -e[exist]: ...
- luogu P1018 乘积最大
题目描述 今年是国际数学联盟确定的"2000――世界数学年",又恰逢我国著名数学家华罗庚先生诞辰90周年.在华罗庚先生的家乡江苏金坛,组织了一场别开生面的数学智力竞赛的活动,你的一 ...
- tomcat启动报异常(一)
异常问题:Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web ...
- html中的列表标签
1.<dl>定义列表,<dt>定义列表中的项目,<dd>对项目的描述 例: 效果: 2.<ul>无序列表,<li>列表项 例: 效果: 3. ...
- Go语言 -- 获取命令行参数
部署golang项目时难免要通过命令行来设置一些参数,那么在golang中如何操作命令行参数呢?可以使用flag库和os库.1.flag库的使用 Go语言标准库提供了用于快迅解析命令行参数的flag包 ...
- 何时才使用https访问项目
利用keytools生产证书,然后将证书导入到jvm和tomcat中,则访问该项目的时候就以https访问