【问题标题】:can't install expo-cli in the new win 10 1903无法在新的 win 10 1903 中安装 expo-cli
【发布时间】:2019-12-01 12:43:26
【问题描述】:

我安装了 node js 13.2,我什至尝试安装 yarn。 在 Visual Studio 安装程序中,我勾选了 C++ 构建工具和节点 js msbuild。 然而,每当我在全球范围内安装 expo-cli 时,都会出现以下错误:

sharp.cc
  utilities.cc
  win_delay_load_hook.cc
C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_modules\sharp\src\stats.cc(130,1): error C2661: 'v8::Obj
ect::Set': no overloaded function takes 2 arguments [C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_mod
ules\sharp\build\sharp.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_modules\sharp
gyp ERR! node -v v13.2.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

最后是这个:

> envsub@3.1.0 postinstall C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_modules\envsub
> test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true

'test' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sharp@0.22.1 (node_modules\expo-cli\node_modules\sharp):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sharp@0.22.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

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\uPanda\AppData\Roaming\npm-cache\_logs\2019-12-01T12_34_33_996Z-debug.log

C:\Windows\system32>expo
internal/modules/cjs/loader.js:957
    throw err;
    ^

【问题讨论】:

    标签: javascript node.js react-native expo


    【解决方案1】:

    我也有同样的问题。 操作系统:赢 10。 据我了解,它与 envsub@3.1.0 该问题已在新版本的 envsub 中修复,但 expo-cli 仍使用 3.1.0

    附言

    3.5.0 作品

    npm install -g expo-cli@3.5.0
    

    【讨论】:

    • 谢谢 知道问题不是我造成的,这让我松了一口气!
    【解决方案2】:

    执行以下操作: expo init 按照提示进行操作。 您可以选择使用 Yarn 或 npm 安装。 它对我有用。

    【讨论】:

      【解决方案3】:

      我解决了这个问题,答案很简单:

      永远不要以管理员权限运行npm

      【讨论】:

      • 您能否深入了解为什么这很重要? @UPanda
      • @Mallesbixie 实际上,如果您以管理员权限运行 npm,它无法识别用户,它会自动尝试在 system32 的某个文件夹中创建node_modules,这是在旧版本的节点中,现在已经修复了
      猜你喜欢
      • 2020-07-09
      • 2021-11-12
      • 1970-01-01
      • 2019-05-16
      • 2021-08-10
      • 2023-03-10
      • 1970-01-01
      • 2019-05-10
      相关资源
      最近更新 更多