npm问题汇总
发布日期:2021-07-01 02:41:52 浏览次数:2 分类:技术文章

本文共 2084 字,大约阅读时间需要 6 分钟。

1、npm.config.loaded ? npm.config.get(’_exit’) : true

Error: EINVAL: invalid argument, mkdir 'G:\blog_github\“F:\SP\node\node_global”;'TypeError: Cannot read property 'loaded' of undefined    at exit (E:\博客\node\node_modules\npm\lib\utils\error-handler.js:97:27)    at errorHandler (E:\博客\node\node_modules\npm\lib\utils\error-handler.js:216:3)    at E:\博客\node\node_modules\npm\bin\npm-cli.js:78:20    at cb (E:\博客\node\node_modules\npm\lib\npm.js:225:22)    at E:\博客\node\node_modules\npm\lib\npm.js:263:24    at E:\博客\node\node_modules\npm\lib\config\core.js:81:7    at Array.forEach (
) at E:\博客\node\node_modules\npm\lib\config\core.js:80:13 at f (E:\博客\node\node_modules\npm\node_modules\once\once.js:25:25) at afterExtras (E:\博客\node\node_modules\npm\lib\config\core.js:171:20)E:\博客\node\node_modules\npm\lib\utils\error-handler.js:97 var doExit = npm.config.loaded ? npm.config.get('_exit') : true ^TypeError: Cannot read property 'loaded' of undefined at exit (E:\博客\node\node_modules\npm\lib\utils\error-handler.js:97:27) at process.errorHandler (E:\博客\node\node_modules\npm\lib\utils\error-handler.js:216:3) at process.emit (events.js:210:5) at process._fatalException (internal/process/execution.js:150:25)

解决

  • 第一种:

在编辑器中打开以下文件:

/usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js
到 11 行,将 uidSupport = process.getuid && process.setuid 修改为 uidSupport = false

  • 第二种:

删除 /Users/{user目录}/.npmrc

  • 第三种:

全局安装变量被设置成空文件夹

①检测自己的全局安装位置:npm config get prefix
②找到之前安装node.js的位置,将node.js的原文件夹复制一份,到刚才的根据命令得到的全局安装位置,复制过去!

https://blog.csdn.net/qq_43511842/article/details/103686452

2、npm link

通过 npm link 可以很容易的调试开发库,有几个需要注意的地方:

  • 目录地址,看一下要链接的地址是不是正确
  • Mac 上需要使用 sudo

3、设置代理

$ npm config set proxy=http://127.0.0.1:8087$ npm config delete proxy$ npm config set registry=http://registry.npmjs.org

4、奇怪报错

Unexpected end of JSON input while parsing near '...75189a47b39759b783e",'

5、用户名

# 查看$ git config user.name$ git config user.email#  设置$ git config --global user.name "username"$ git config --global user.email "email"

转载地址:https://melodyjerry.blog.csdn.net/article/details/108742935 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Xshell-设置命令行提示符&配色方案
下一篇:Hexo博客加入聊天系统DaoVoice

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年05月01日 18时55分15秒