0

我用谷歌搜索了许多相关问题,但我迷路了,因为我是离子的初学者。

我的 npm 版本:6.1.0

我的nodejs版本:10.5.0

我克隆了一个私人仓库,我做的第一件事就是npm i安装软件包。

然后我在到达这里时遇到错误:

> grpc@1.10.0 install D:\Projects\...\the-project\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

然后抛出了一堆错误:

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.0/node-v64-win32-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.0 and node@10.5.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.0/node-v64-win32-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.0 and node@10.5.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at D:\Program File\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! gypSystem Windows_NT 10.0.16299
 ERR! configure error
gyp gypERR!  commandERR! "D:\\Program File\\nodejs\\node.exe" "D:\\Program File\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=D:\\Projects\\...\\the-project\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=D:\\Projects\\...\\the-project\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown" "--python=python2.7" "--msvs_version=2013"
 stackgyp Error: Can't find Python executable "python2.7", you can set the PYTHON env variable.
 gypERR!  ERR!cwd  D:\Projects\...\the-project\node_modules\grpc
stackgyp     at PythonFinder.failNoPython (D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
 gypERR!  ERR!node -v  v10.5.0
stackgyp     at PythonFinder.<anonymous> (D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
 gypERR!  node-gyp -v v3.6.2
gyp ERR!ERR!  stacknot ok     at D:\Program File\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29

gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "D:\\Program File\\nodejs\\node.exe" "D:\\Program File\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=D:\\Projects\\...\\the-project\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=D:\\Projects\\...\\the-project\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown" "--python=python2.7" "--msvs_version=2013"
gyp ERR! cwd D:\Projects\...\the-project\node_modules\grpc
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not oknode-pre-gyp
 ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'D:\Program File\nodejs\node.exe D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=D:\Projects\...\the-project\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=D:\Projects\...\the-project\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown --python=python2.7 --msvs_version=2013' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Projects\...\the-project\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "D:\\Program File\\nodejs\\node.exe" "D:\\Projects\\...\\the-project\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd D:\Projects\...\the-project\node_modules\grpc
node-pre-gyp ERR! node -v v10.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'D:\Program File\nodejs\node.exe D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=D:\Projects\Projects\...\the-project\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=D:\Projects\...\IONIC\client app\foodNinjaCustomerApp\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown --python=python2.7 --msvs_version=2013' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.10.0 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.10.0 install 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\....\AppData\Roaming\npm-cache\_logs\2018-10-08T10_00_32_262Z-debug.log

我已经用谷歌搜索并检查了许多 github/stackoverflow 帖子,但我仍然迷失在中间,因为所有解决方案都不同,我也不明白它的用途。

因此我需要帮助你,请告诉我该怎么做。

到目前为止,我所做的事情是:

1)npm install --msvs_version=2013 -g node-inspector:错误

2) npm config set msvs_version 2013: 没有结果

3)node-pre-gyp install --fallback-to-build:错误'node-pre-gyp' is not recognized as an internal or external command, operable program or batch file.

4

1 回答 1

0

该错误表明未找到python。

gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable.

因此,您应该安装它(2.7 版)并将其添加到系统变量中。

于 2018-10-30T15:00:11.183 回答