nei icon indicating copy to clipboard operation
nei copied to clipboard

请问npm install时出现问题!

Open ss958 opened this issue 5 years ago • 7 comments

git源码后 npm install nej -g 完成,下一步 npm install 时出现 node-gyp rebuild 卡主不动的问题。请问怎么处理? TIM截图20200424234901

ss958 avatar Apr 24 '20 15:04 ss958

1、升级一下 Node 版本 2、npm 安装使用其他镜像试试,比如:npm install --registry=https://registry.npm.taobao.org

huntbao avatar Apr 26 '20 01:04 huntbao

谢谢 我在尝试下 有问题继续反馈,Node 版本是 v12.16.2

ss958 avatar Apr 26 '20 01:04 ss958

实测切换国内镜像也没用。下载可以正常,只是在 node-gyp 编译环境卡主。环境 cenos7 有大神可以将编译好的依赖库上传上来么?node_modules 文件夹

ss958 avatar Apr 26 '20 01:04 ss958

@ss958 解决了吗?这个是 Node 本身的问题。

huntbao avatar Apr 27 '20 11:04 huntbao

[email protected] install E:\nei_\node_modules\hiredis node-gyp rebuild

E:\nei_\node_modules\hiredis>if not defined npm_config_node_gyp (node "D:\nvm\v14.0.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "D:\nvm\v14.0.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: read ECONNRESET gyp ERR! stack at TLSWrap.onStreamRead (internal/stream_base_commons.js:205:27) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\nvm\v14.0.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd E:\nei_\node_modules\hiredis gyp ERR! node -v v14.0.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok

[email protected] install E:\nei_\node_modules\nodejieba node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Tried to download(404): https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v83-win32-x64.tar.gz node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, unknown) (falling back to source compile with node-gyp)

请问为什么npm install了之后会自动执行这个gyp的命令并且失败了呢,Node版本是14.0.0

swiich avatar Sep 04 '20 06:09 swiich

是不是切过 Node 版本?删除 node_modules 后再试试

不行的话试试低版本 Node(同样要删除 node_modules

还是不行就试试 cnpm:

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install

int64ago avatar Sep 04 '20 07:09 int64ago

是不是切过 Node 版本?删除 node_modules 后再试试

不行的话试试低版本 Node(同样要删除 node_modules

还是不行就试试 cnpm:

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install

E:\nei_>cnpm install | [3/31] Installing koa-router@^5.4.0[[email protected] › koa-body-parsers@git+https://github.com/tunnckoCore/body-parsers.git] install koa-body-parsers from git git+https://github.com/tunnckoCore/body-parsers.git, may be very slow, please keep patience \ [12/31] Installing raw-body@^2.1.0[npminstall:runscript] [email protected] › hiredis@~0.5.0 found binding.gyp file, auto run "node-gyp rebuild", root: "E:\nei_\node_modules\[email protected]@hiredis"

E:\nei_\[email protected]@hiredis>node "D:\nvm\v12.18.3\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" rebuild \ [14/31] Installing pinyin@^2.7.3gyp ERR! configure error gyp ERR! stack Error: Command failed: D:\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "", line 1 gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack ^ gyp ERR! stack SyntaxError: invalid syntax gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:303:12) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/child_process.js:286:5) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\nvm\v12.18.3\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" "rebuild" gyp ERR! cwd E:\nei\[email protected]@hiredis gyp ERR! node -v v12.18.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok [npminstall:runscript:error] [email protected] › hiredis@~0.5.0 has binding.gyp file, run "node-gyp rebuild" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild" error, exit code 1 at ChildProcess. (D:\nvm\v12.18.3\node_modules\cnpm\node_modules\runscript\index.js:96:21) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) { stdio: [Object], exitcode: 1 } | [14/31] Installing pinyin@^2.7.3[hiredis@~0.5.0] optional install error: RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild" error, exit code 1 at ChildProcess. (D:\nvm\v12.18.3\node_modules\cnpm\node_modules\runscript\index.js:96:21) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) | [23/31] Installing path-dirname@^1.0.0platform unsupported [email protected][email protected] › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(win32) / [23/31] Installing tweetnacl@^0.14.3[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(win32) \ [26/31] Installing is-buffer@^1.1.5[[email protected] › gkt@https://tgz.pm2.io/gkt-1.0.0.tgz] install gkt from remote https://tgz.pm2.io/gkt-1.0.0.tgz, may be very slow, please keep patience \ [28/31] Installing tar@^4.4.2 WARN node unsupported "[email protected]" is incompatible with [email protected][email protected] › hawk@~0.10.2, expected [email protected]

WARN node unsupported "[email protected]" is incompatible with [email protected][email protected][email protected][email protected], expected [email protected]

WARN node unsupported "[email protected]" is incompatible with [email protected][email protected][email protected][email protected], expected [email protected] \ [29/31] Installing readable-stream@^2.0.6 WARN node unsupported "[email protected]" is incompatible with [email protected][email protected][email protected][email protected], expected [email protected] √ Installed 31 packages √ Linked 355 latest versions [1/2] scripts.postinstall ejs@^2.5.1 run "node ./postinstall.js", root: "E:\nei_\node_modules\[email protected]@ejs" Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

[1/2] scripts.postinstall ejs@^2.5.1 finished in 91ms [2/2] scripts.install [email protected] › nodejieba@^2.2.1 run "node-pre-gyp install --fallback-to-build", root: "E:\nei_\node_modules\[email protected]@nodejieba" node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp http GET https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v72-win32-x64.tar.gz node-pre-gyp http 404 https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v72-win32-x64.tar.gz node-pre-gyp WARN Tried to download(404): https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v72-win32-x64.tar.gz node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp http 404 status code downloading tarball https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v72-win32-x64.tar.gz

E:\nei_\[email protected]@nodejieba>node "D:\nvm\v12.18.3\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" clean

E:\nei_\[email protected]@nodejieba>node "D:\nvm\v12.18.3\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" configure --fallback-to-build --module=E:\nei_\[email protected]@nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=E:\nei_\[email protected]@nodejieba\build\Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72 gyp ERR! configure error gyp ERR! stack Error: Command failed: D:\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "", line 1 gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack ^ gyp ERR! stack SyntaxError: invalid syntax gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:303:12) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/child_process.js:286:5) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\nvm\v12.18.3\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" "configure" "--fallback-to-build" "--module=E:\nei\node_modules\[email protected]@nodejieba\build\Release\nodejieba.node" "--module_name=nodejieba" "--module_path=E:\nei\node_modules\[email protected]@nodejieba\build\Release" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72" gyp ERR! cwd E:\nei\[email protected]@nodejieba gyp ERR! node -v v12.18.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=E:\nei_\[email protected]@nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=E:\nei_\[email protected]@nodejieba\build\Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) node-pre-gyp ERR! stack at ChildProcess. (E:\nei_\[email protected]@node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) node-pre-gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/child_process.js:286:5) node-pre-gyp ERR! System Windows_NT 10.0.18362 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\nei\node_modules\[email protected]@node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd E:\nei\[email protected]@nodejieba node-pre-gyp ERR! node -v v12.18.3 node-pre-gyp ERR! node-pre-gyp -v v0.14.0 node-pre-gyp ERR! not ok Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=E:\nei_\[email protected]@nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=E:\nei_\[email protected]@nodejieba\build\Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) [npminstall:runscript:error] [email protected] › nodejieba@^2.2.1 scripts.install run "node-pre-gyp install --fallback-to-build" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build" error, exit code 1 at ChildProcess. (D:\nvm\v12.18.3\node_modules\cnpm\node_modules\runscript\index.js:96:21) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) { stdio: [Object], exitcode: 1 } [email protected] › nodejieba@^2.2.1 optional error: RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build" error, exit code 1 at ChildProcess. (D:\nvm\v12.18.3\node_modules\cnpm\node_modules\runscript\index.js:96:21) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess.handle.onexit (internal/child_process.js:286:5) √ Run 2 scripts deprecate nodemailer@^2.4.1 All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/ deprecate [email protected][email protected] This project is unmaintained deprecate [email protected][email protected] If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 deprecate [email protected][email protected][email protected] This project is unmaintained deprecate request@^2.79.0 request has been deprecated, see https://github.com/request/request/issues/3142 deprecate [email protected] › har-validator@~5.1.3 this library is no longer supported deprecate [email protected] › chokidar@^2 Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. deprecate [email protected][email protected] Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) deprecate [email protected][email protected] › fsevents@^1.2.7 fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. deprecate [email protected][email protected][email protected][email protected][email protected] › urix@^0.1.0 Please see https://github.com/lydell/urix#deprecated deprecate [email protected] › mkdirp@~0.3.5 Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) deprecate [email protected][email protected] request has been deprecated, see https://github.com/request/request/issues/3142 deprecate [email protected][email protected] › minimatch@~0.2.11 Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue deprecate [email protected][email protected] › node-uuid@~1.4.0 Use uuid module instead deprecate [email protected][email protected][email protected] › graceful-fs@~1.2.0 please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js deprecate [email protected][email protected] › hawk@~0.10.2 This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. deprecate [email protected][email protected][email protected][email protected] 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). deprecate [email protected][email protected][email protected][email protected] This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. deprecate [email protected][email protected][email protected][email protected] 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). deprecate [email protected][email protected][email protected][email protected] 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). Recently updated (since 2020-08-28): 3 packages (detail see file E:\nei\node_modules.recently_updates.txt) √ All packages installed (454 packages installed from npm registry, 1 packages installed from remote url, 1 packages installed from git, used 18s(network 12s), speed 65.16kB/s, json 384(813.1kB), tarball 0B)

试了node版本 12.18.3和 14.0.0还有8.5.0报错都是这样 好像用到了Python?我的python版本是3.7.3

python版本切换到2.7 gyp的报错会变成这样

  • [27/31] Installing tunnel-agent@~0.3.0gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (D:\nvm\v12.18.3\node_modules\cnpm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at emitTwo (events.js:125:13) gyp ERR! stack at ChildProcess.emit (events.js:213:7) gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/child_process.js:200:12) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\nvm\v12.18.3\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" "rebuild" gyp ERR! cwd E:\nei\[email protected]@hiredis gyp ERR! node -v v8.5.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok [npminstall:runscript:error] [email protected] › hiredis@~0.5.0 has binding.gyp file, run "node-gyp rebuild" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild" error, exit code 1 at ChildProcess. (D:\nvm\v12.18.3\node_modules\cnpm\node_modules\runscript\index.js:96:21) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) { stdio: [Object], exitcode: 1 }

swiich avatar Sep 04 '20 07:09 swiich