NPM 問題匯總


1、Error: setuid user id does not exist

Error: setuid user id does not exist
    at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:49:16
    at ChildProcess.exithandler (child_process.js:285:7)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:610:12)
TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
    at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:77:20
    at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
    at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
    at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true
                          ^

TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at process.emit (events.js:182:13)
    at process._fatalException (internal/bootstrap/node.js:494:27)

在編輯器中打開以下文件:
/usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js
到 11 行,將 uidSupport = process.getuid && process.setuid 修改為 uidSupport = false

通過 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"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM