代码 ELIFECYCLE 错误 安装 expo-cli 时

Mih*_*iuc 13 node.js npm

npm install expo-cli --global
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! envsub@3.1.0 postinstall: `test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the envsub@3.1.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!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-12-01T12_11_45_118Z-debug.log
Run Code Online (Sandbox Code Playgroud)

节点和 npm 版本:

node --version
v12.13.1
npm --version
6.12.1
Run Code Online (Sandbox Code Playgroud)

我正在尝试在 Windows 10 上安装 expo-cli,根据它的官方网站:

npm install expo-cli --global 我收到以下错误:

43056 详细 Windows_NT 10.0.18362 43057 详细 argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "expo-cli " "--global" 43058 详细节点 v12.13.1 43059 详细 npm v6.12.1 43060 错误代码 ELIFECYCLE 43061 错误 errno 1 43062 错误 envsub@3.1.0 安装后:test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true 43062 错误@3.1.0 安装后错误:43062 错误 @3.1.0 退出状态错误安装后脚本。43063 错误 这可能不是 npm 的问题。上面可能有额外的日志输出。43064 详细退出 [1, true] 我使用的是 python 版本:

python --version Python 3.8.0 和 node 和 npm 版本:

节点 --version v12.13.1

npm --version 6.12.1 ** 你有什么建议?

**

小智 19

只需尝试npm install expo-cli --global在 git bash 上安装此命令。它对我有用。


say*_*bir 1

我解决了这个问题

1- Download and install Git SCM
2- Download Visual Studio Community HERE and install a Custom Installation, selecting ONLY the following packages: VISUAL C++, PYTHON TOOLS FOR VISUAL STUDIO and MICROSOFT WEB DEVELOPER TOOLS
3- Download and install Python 2.7.x
4- Register a Environment Variable with name: GYP_MSVS_VERSION with this value: 2015
Run Code Online (Sandbox Code Playgroud)

安装完这些之后我认为这部分很重要:

envsub的安装后脚本依赖于内置的unix shell命令。所以任何与 unix shell 兼容的 shell 都应该可以工作,比如Git BASH

所以npm install expo-cli --global在上面安装后运行Git BASH