Ошибки зависимости / разрешения узла при установке expo-cli - PullRequest
1 голос
/ 26 мая 2019

Я пытаюсь установить expo, чтобы использовать реагировать нативно, используя npm install -g expo-cli, но я получаю огромные журналы ошибок.

Я пытался набрать /usr/local, используя sudo chown -R $(whoami) $(brew --prefix)/* /usr/local и sudo chown -R $USER /usr/local, но получаю chown: /usr/local: Operation not permitted. Я попытался обновить node и npm, удалить их, переустановить, обновить с помощью homebrew, установить expo-cli с помощью homebrew. Я попытался установить sudo. Я получаю похожие ошибки. Я попытался yarn add global expo-cli, и я получил почти тот же вывод, который получил от npm install -g expo-cli о зависимостях.

Вот вывод, который я получаю в терминале от запуска npm install -g expo-cli:

npm WARN deprecated joi@11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated topo@2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN @expo/dev-tools@0.5.14 requires a peer of @expo/xdl@^53.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp@1.1.2 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

Когда я пытаюсь использовать yarn add, я получаю те же ошибки с зависимостями, но вместо "npm ERR!" Часть, которую я получаю:

[2/4] ?  Fetching packages...
info @expo/traveling-fastlane-linux@1.9.4: The platform "darwin" is incompatible with this module.
info "@expo/traveling-fastlane-linux@1.9.4" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-darwin-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
info "@expo/ngrok-bin-darwin-ia32@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-arm@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-linux-arm@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-arm@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-linux-arm64@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-linux-arm64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-arm64@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-freebsd-x64@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-freebsd-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-freebsd-ia32@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-freebsd-ia32@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-freebsd-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-linux-x64@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-linux-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-sunos-x64@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-sunos-x64@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-win32-ia32@2.2.8-beta.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: The CPU architecture "x64" is incompatible with this module.
info @expo/ngrok-bin-win32-x64@2.2.8-beta.1: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-win32-x64@2.2.8-beta.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-ia32@2.2.8: The platform "darwin" is incompatible with this module.
info "@expo/ngrok-bin-linux-ia32@2.2.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info @expo/ngrok-bin-linux-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
[3/4] ?  Linking dependencies...
warning "expo-cli > @expo/dev-tools@0.5.14" has incorrect peer dependency "@expo/xdl@^53.8.0".
error An unexpected error occurred: "EACCES: permission denied, unlink '/Users/<username>/node_modules/.bin/detect-libc'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/<username>/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Когда я запускаю sudo npm install -g expo-cli, я получаю следующее:

npm WARN deprecated joi@14.0.4: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated joi@11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated topo@2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.

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

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:1077
        path = process.cwd();
                       ^

Error: EACCES: permission denied, uv_cwd
    at Object.resolve (path.js:1077:24)
    at startup (internal/bootstrap/node.js:269:32)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
/usr/local/bin/expo-cli -> /usr/local/lib/node_modules/expo-cli/bin/expo.js
/usr/local/bin/expo -> /usr/local/lib/node_modules/expo-cli/bin/expo.js

> fsevents@1.2.9 install /usr/local/lib/node_modules/expo-cli/node_modules/fsevents
> node install

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:1077
        path = process.cwd();
                       ^

Error: EACCES: permission denied, uv_cwd
    at Object.resolve (path.js:1077:24)
    at startup (internal/bootstrap/node.js:269:32)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

> iltorb@2.4.3 install /usr/local/lib/node_modules/expo-cli/node_modules/iltorb
> node ./scripts/install.js || node-gyp rebuild

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:1077
        path = process.cwd();
                       ^

Error: EACCES: permission denied, uv_cwd
    at Object.resolve (path.js:1077:24)
    at startup (internal/bootstrap/node.js:269:32)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
sh: node-gyp: command not found
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

> sharp@0.22.1 install /usr/local/lib/node_modules/expo-cli/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:1077
        path = process.cwd();
                       ^

Error: EACCES: permission denied, uv_cwd
    at Object.resolve (path.js:1077:24)
    at startup (internal/bootstrap/node.js:269:32)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
sh: node-gyp: command not found
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
npm WARN @expo/dev-tools@0.5.14 requires a peer of @expo/xdl@^53.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp@1.1.2 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-linux@1.9.4 (node_modules/expo-cli/node_modules/@expo/traveling-fastlane-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/traveling-fastlane-linux@1.9.4: wanted {"os":"win32,linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-win32-x64@2.2.8-beta.1 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-win32-x64@2.2.8-beta.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-win32-ia32@2.2.8-beta.1 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-win32-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: wanted {"os":"win32","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-sunos-x64@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-sunos-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-sunos-x64@2.2.8: wanted {"os":"sunos","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-x64@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-x64@2.2.8: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-ia32@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-linux-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-ia32@2.2.8: wanted {"os":"linux","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-arm64@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-linux-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-arm64@2.2.8: wanted {"os":"linux","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-arm@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-linux-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-arm@2.2.8: wanted {"os":"linux","arch":"arm"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-ia32@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-freebsd-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-ia32@2.2.8: wanted {"os":"freebsd","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-x64@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-freebsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-x64@2.2.8: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-darwin-ia32@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-darwin-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-darwin-ia32@2.2.8: wanted {"os":"darwin","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-darwin@1.9.4 (node_modules/expo-cli/node_modules/@expo/traveling-fastlane-darwin):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-darwin@1.9.4 preinstall: `node platform.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/expo-cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@2.4.3 (node_modules/expo-cli/node_modules/iltorb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@2.4.3 install: `node ./scripts/install.js || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! sharp@0.22.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the sharp@0.22.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Я ожидал, что вывод скажет что-то вроде expo, установленного нормально, но вместо этого он выдаст мне журналы ошибок о зависимостях и разрешениях.

Ответы [ 3 ]

0 голосов
/ 27 мая 2019

Вы можете использовать npx альтернативу npm install.Я не могу исправить ошибку, но $ npx expo init Awesomeproject работает.

Единственный недостаток использования npx - это больше времени, чем при использовании предустановленной expo.Попробуйте npx!

0 голосов
/ 23 июня 2019

Лучшее решение, которое я нашел, поскольку это связано с некоторыми новыми элементами управления разрешениями в macOS, - это использовать здесь вариант 2: https://github.com/mixonic/docs.npmjs.com/blob/master/content/getting-started/fixing-npm-permissions.md

Это меняет домашнюю папку по умолчанию для глобальных модулей, которая может потребовать переустановкидругих, когда пришло время обновлять, но это не повлияет на уже установленные.

В противном случае небезопасный способ сделать это:

sudo npm i -g --unsafe-пермская экспо-кли

0 голосов
/ 27 мая 2019

У вас должен быть доступ суперпользователя для глобальной установки пакета. Пытаться: sudo npm install -g expo-cli

...