在Mac上安装remotebuild失败,“uid必须是一个unsigned int”

我试图在我的Mac上安装remotebuild,在我的Mac上通过Visual Studio 2015部署Cordova应用程序。

技术信息:macOS Sierra节点v4.6.0 npm v3.10.8 xcode 8

但它失败,出现以下错误:“uid必须是一个无符号的整数”

我试图重新安装npm没有成功。

$ sudo npm install -g remotebuild npm WARN deprecated wrench@1.5.9: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years. npm ERR! Darwin 16.0.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "remotebuild" npm ERR! node v4.6.0 npm ERR! npm v3.10.8 npm ERR! uid must be an unsigned int npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! <https://github.com/npm/npm/issues> npm ERR! Darwin 16.0.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "remotebuild" npm ERR! node v4.6.0 npm ERR! npm v3.10.8 .... npm ERR! uid must be an unsigned int npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! <https://github.com/npm/npm/issues> 

但它失败,出现以下错误:“uid必须是一个无符号的整数”

这是一个已知的问题,根本原因是在Node.js内核中,OS X上nobodyUID (被-2转换为无符号整数fs.stat()将由fs.stat()作为有符号整数返回。 请参阅Github中的讨论。 这个问题只存在于npm v3.10.8

修复程序已更新。 请参阅fs:修复处理struct stat字段#8515 。

这将通过将节点模块的权限重置为您的ID来解决该问题:

 sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} 

为了logging,这种情况发生在安装Cordova的许多不同的问题上:

 npm install -g cordova