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
则不然。
最佳答案
我也遇到了同样的问题。 我在此页面上找到了类似的答案:
总而言之,该错误似乎是由于新安装的 node/npm 没有清除所有旧文件,这些文件随后妨碍了新安装。
我发现使用以下命令重新安装:
npm install -g npm@latest
帮助了我。
关于node.js - npm install @types/jquery 导致名称无效 : "@types/jquery",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42307611/