安装Expo时,我收到“允许拒绝”错误

时间:2018-01-27 11:00:50

标签: npm expo

当我尝试安装Expo SDK时,我收到了权限错误:

sudo npm install exp --global

> @expo/traveling-fastlane-darwin@1.2.5 preinstall /usr/local/lib/node_modules/exp/node_modules/@expo/traveling-fastlane-darwin
> node platform.js

/usr/local/bin/exp -> /usr/local/lib/node_modules/exp/bin/exp.js

> spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/exp/node_modules/spawn-sync
> node postinstall


> @expo/ngrok@2.3.0 postinstall /usr/local/lib/node_modules/exp/node_modules/@expo/ngrok
> node ./postinstall.js

ngrok - error unpacking binary { Error: EACCES: permission denied, open '/usr/local/lib/node_modules/exp/node_modules/@expo/ngrok/bin/ngrok'
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/usr/local/lib/node_modules/exp/node_modules/@expo/ngrok/bin/ngrok' }
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-linux@1.2.5 (node_modules/exp/node_modules/@expo/traveling-fastlane-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/traveling-fastlane-linux@1.2.5: wanted {"os":"win32,linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @expo/ngrok@2.3.0 postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @expo/ngrok@2.3.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chris/.npm/_logs/2018-01-27T10_59_33_236Z-debug.log

我正在使用npm 5.5.1 + node v8.9.1 + macOS high sierra

3 个答案:

答案 0 :(得分:1)

你真的不应该在npm中使用sudo。我想说请修改你的权限或作为一个更直接的解决方案,npm install --dev exp,所以它成为你的项目的devDependency。

答案 1 :(得分:0)

此命令对我有效sudo snap install ngrok

答案 2 :(得分:0)

这对我有用:

sudo npm install --unsafe-perm -g expo-cli