【问题标题】:npm install @types/jquery leads to Invalid name: "@types/jquery"npm install @types/jquery 导致名称无效:“@types/jquery”
【发布时间】:2023-03-21 04:35:01
【问题描述】:
npm install @types/jquery
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@types/jquery"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2

npm ERR! Invalid name: "@types/jquery"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     T:\...\npm-debug.log

如果出现类似错误,Stack Overflow 和 GitHub 上的大多数人建议升级 Node,但正如您在输出中看到的那样:Node 已经是最新版本(Node 4 和 Node 6.9 不起作用以及)。

因此我猜这与 Windows 10 的交互和这台机器上的某些设置有关(因为其他 Windows 10 机器不受影响)。

在机器上安装任意无范围的包没有任何问题,而npm install @types/jquery 则没有。

【问题讨论】:

  • 可能与那个流浪的T:驱动器有关?
  • 直到周末我都无法访问机器。我会测试是否是这个原因。为什么你认为T: 可能是问题所在?

标签: node.js typescript npm windows-10


【解决方案1】:

我遇到了同样的问题。 我在此页面上找到了类似的答案:

https://github.com/npm/npm/issues/13986

总而言之,错误似乎是由于新安装的 node/npm 没有清除所有旧文件,这些旧文件会妨碍新安装。

我发现用命令重新安装:

npm install -g npm@latest

帮了我。

【讨论】:

  • 对我没有帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-12
  • 2018-07-25
  • 2019-06-28
  • 2017-01-08
相关资源
最近更新 更多