npm-install - 无法安装 node-pty-prebuilt - 错误太多

标签 npm-install permission-denied android-app-signing

我正在尝试运行 expo opt-in-google-play-signing 但在我粘贴以下加密 key 后它会抛出错误:

fatal error: too many errors emitted, stopping now [-ferror-limit=]
11 warnings and 20 errors generated.

Run npm -g install node-pty-prebuilt to install node pty
Error: Package node-pty-prebuilt is required to use PEPK tool

最初,当我运行建议的 npm install 时,我遇到了一个权限问题,该问题已使用 sudo chown -R $USER/usr/local/lib/node_modules 解决,但是当我运行该解决方案时 npm -g install node-pty-prebuilt 它再次失败:

fatal error: too many errors emitted, stopping now [-ferror-limit=]
11 warnings and 20 errors generated.
make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--build_v8_with_gn=false"
gyp ERR! cwd /usr/local/lib/node_modules/node-pty-prebuilt
gyp ERR! node -v v12.16.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-pty-prebuilt@0.7.6 install: `prebuild-install || node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-pty-prebuilt@0.7.6 install script.

如果使用 sudo 运行我得到:

prebuild-install WARN install EACCES: permission denied, access '/Users/uxdw/.npm'

这次运行chown脚本似乎并没有解决上面的访问问题,给出:

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/uxdw/Library/Caches/node-gyp/12.16.2"

这是在 Mojave 上的 macbook 上以管理员帐户运行的。

最佳答案

这可以通过简单地降级事件节点版本来解决。 在撰写本文时,它适用于 v10.12.0 或 v10.13.0。

我使用节点版本管理器 (NVM) 在版本之间进行热切换。

安装 NVM:

Brew install nvm
source ~/.nvm/nvm.sh (relinks nvm until is set as default on Terminal launch)

安装节点版本:

nvm install node // install node
nvm install 8.9  // install specific version
nvm uninstall x.x // uninstall specific version

切换到特定版本:

nvm use x.x // use a specific version

更多详情:NVM

关于npm-install - 无法安装 node-pty-prebuilt - 错误太多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61837987/

相关文章:

javascript - 将外部库导入 javascript 文件

android - 选择退出 Google Play App Signing 是永久性的吗?

node.js - npm-EPERM : operation not permitted on Linux

javascript - 'npm add' 和 'npm install --save' 之间的区别?

android模拟器-任何可访问的存储空间?

ios - iOS 项目中的 Pods-resources.sh 权限被拒绝

android - 如何将一个帐户用于多个应用程序(AccountAuthenticator、sharedUserId、Google Play App Signing)?

android - Google 登录无法使用从 Play 商店下载的应用程序

javascript - 从 fork 的 npm 包导入组件时出错

permission-denied - Rails:权限被拒绝 - "127.0.0.1"端口 3000 的绑定(bind)(2)(Errno::EACCES)