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"
posted @   叙帝利  阅读(1377)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示