node.js - npm install @types/jquery 导致名称无效 : "@types/jquery"

标签 node.js typescript npm windows-10

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和 native 上的某些设置的交互有关(因为其他Windows 10机器不受影响)。

在计算机上安装任意无作用域的包不会出现任何问题,而 npm install @types/jquery 则不然。

最佳答案

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

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

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

我发现使用以下命令重新安装:

npm install -g npm@latest

帮助了我。

关于node.js - npm install @types/jquery 导致名称无效 : "@types/jquery",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42307611/

相关文章:

node.js - 用 Angular 突出显示?

node.js - 无法使用 pm2 和 ts-node 运行 typescript node.js 应用程序

node.js - 哪个在 ubuntu node 或 nodejs 上是正确的?如何获得当前的工作版本?

node.js - 高内存/性能关键计算-体系结构方法意见

node.js - Nodejs - 错误回调的重新调用函数 - 是否有非阻塞方式?

node.js - Nodejs Assets 管理

node.js - 如何在 Insomnia GET 请求中设置 req.params?

arrays - 订阅 Angular 6

node.js - npm 代理设置转义 '\' 字符

javascript - Amazon AWS SDK MediaConvert 不是构造函数