npm ERR 拒绝安装名为 <packageName> 的包在也称为 &lt;packageName&gt; 的包下 [英] npm ERR Refusing to install package with name &lt;packageName&gt; under a package also called &lt;packageName&gt;

查看:35
本文介绍了npm ERR 拒绝安装名为 <packageName> 的包在也称为 &lt;packageName&gt; 的包下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的项目中使用

解决方案

package.json 中的项目名称与您尝试安装的模块名称相同时,会导致此问题.

要解决此问题,请将package.json 中的项目名称更改为其他名称.例如,jsonfile-test":

<代码>{名称":jsonfile-test",版本":1.0.0",描述":",主要":index.js",脚本":{测试":回声\"错误:未指定测试\"&&出口 1"},作者":",许可证":ISC",依赖关系":{}}

I am trying to use the jsonfile package in my project, but I get the following errors:

  1. Refusing to install package with name <packagename> under a package also called <packagename>. (Note that none of the directory or filename is same as package name)

  2. Cannot find module <packagename>.

解决方案

The problem is caused when the name of project in package.json is the same as the module you're trying to install.

To solve this problem, please change the project name in package.json to something else. For example, "jsonfile-test":

{
  "name": "jsonfile-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
  }
}

这篇关于npm ERR 拒绝安装名为 <packageName> 的包在也称为 &lt;packageName&gt; 的包下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆