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 ...
随机推荐
- springboot整合mybatis(SSM开发环境搭建)
0.项目结构: ---------------------方法一:使用mybatis官方提供的Spring Boot整合包实现--------------------- 1.application.p ...
- HTTP PUT方法和POST方法的区别
这两个方法看起来都是讲一个资源附加到服务器端的请求,但其实是不一样的.一些狭窄的意见认为,POST方法用来创建资源,而PUT方法则用来更新资源.这个说法本身没有问题,但是并没有从根本上解释了二者的区别 ...
- [Web Tools] 实用的Web开发工具
模拟http请求:Postman https://www.getpostman.com 生成Json数据 http://www.json-generator.com/
- 四个很好的开源app项目
Open Source and the iOS App Store Today, we are open-sourcing 4 iOS apps: ThatInbox, an email client ...
- mysql 数据库查询优化
从上图可以看出,计算机系统硬件性能从高到代依次为: CPU——Cache(L1-L2-L3)——内存——SSD硬盘——网络——硬盘 由于SSD硬盘还处于快速发展阶段,所以本文的内容不涉及SSD相关应用 ...
- C#应用程序配置文件.config介绍
我们经常会希望在程序中写入一些配置信息,例如版本号,以及数据库的连接字符串等.你可能知道在WinForm应用程序中可以利用Properties.Settings来进行类似的工作,但这些其实都利用了Ap ...
- Pearson product-moment correlation coefficient in java(java的简单相关系数算法)
一.什么是Pearson product-moment correlation coefficient(简单相关系数)? 相关表和相关图可反映两个变量之间的相互关系及其相关方向,但无法确切地表明两个变 ...
- SwitchyOmega 代理设置
1.SwitchyOmega官网 https://www.switchyomega.com/ 2.下载插件 https://www.switchyomega.com/download.html 3.配 ...
- 小胖说事20--------GCD笔记
1.系统提供的dispatch方法 为了方便的使用GCD.苹果提供了一些方法方便我们将BLOCK放在主线程或者后台程序运行.或者延后运行. //后台运行: dispatch_async(dispatc ...
- 数据结构与算法——AVL树类的C++实现
关于AVL树的简单介绍能够參考:数据结构与算法--AVL树简单介绍 关于二叉搜索树(也称为二叉查找树)能够參考:数据结构与算法--二叉查找树类的C++实现 AVL-tree是一个"加上了额外 ...