javascript - 'npm install -g' 找不到 'Roaming\npm\node_modules\' 目录
问题描述
我刚刚将 nodejs 下载并安装到我的新机器上,但“npm install -g”和“npm install”命令都不起作用。它给出了 ENOENT 错误。我检查了全局安装包的路径,即“C:\Users\USER\AppData\Roaming\npm\node_modules”文件夹,错误提示找不到“lib”或“bin”文件夹,但所有文件夹由命令缺少第一个字母。尝试全局安装 typescript 时,会显示我在下面遇到的 npm 错误。我似乎找不到解决方案,有人知道我该怎么办吗?提前致谢。
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\USER\AppData\Roaming\npm\node_modules\.staging\typescript-21dd751b\bin\tsc'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\USER\AppData\Roaming\npm\node_modules\.staging\typescript-21dd751b\bin\tsserver'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\USER\AppData\Roaming\npm\node_modules\.staging\typescript-21dd751b\lib\cancellationToken.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\USER\AppData\Roaming\npm\node_modules\.staging\typescript-21dd751b\lib\cs\diagnosticMessages.generated.json'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache\_logs\2019-11-12T12_33_04_656Z-debug.log
解决方案
推荐阅读
- python - 在python中删除数据框中的重复行
- node.js - 在更新 Node js 中的数据时遇到问题
- python - Python:最近调用最后一个错误
- java - 使用 Java 从 URL 读取 XSD
- c# - 在 Azure Function 中接收 Docx 并返回纯文本
- php - 循环遍历 json 文件以在 PHP 中查找特定值
- python - py2neo:无法创建图形
- android - 在 Android Studio 上实现 firebase 的错误消息
- android - 如何加入 ObjectBox
- python-3.x - “charmap”编解码器无法编码位置 XX 中的字符