meolu / walle-web

walle - 瓦力 Devops开源项目代码部署平台
https://walle-web.io
Apache License 2.0
11.86k stars 2.76k forks source link

npm install BUG #607

Open jeftom opened 5 years ago

jeftom commented 5 years ago

问题描述owner下,什么页面,发布 vue 项目时,手动在shell 执行npm install 时是正常的,在walle发布执行 npm install 脚本时报错:

问题描述 日志堆栈贴上来。

apps@127.0.0.1]$ [ -d ".git" ] && git status
# On branch 2.34temp
nothing to commit, working directory clean
[apps@127.0.0.1]$ cp -rf /data/codebase/1 1_2_20190110_165624
[apps@127.0.0.1]$ git reset -q --hard 0f30dc4
[apps@127.0.0.1]$ npm install chromedriver
build:minimist: sill linkStuff minimist@0.0.8 has /data/ [ ......] / install:performance-now: info lifecycle performance-now@ npm WARN lifecycle npm is using /usr/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> chromedriver@2.45.0 install /data/codebase/1_2_20190110_165624/node_modules/chromedriver
> node install.js
[ ......] \ install: info lifecycle chromedriver@2.45.0~install: Fai [ ......] \ install: info lifecycle chromedriver@2.45.0~install: Fai npm ERR! file sh
npm ERR! path sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn sh
npm ERR! chromedriver@2.45.0 install: `node install.js`
npm ERR! spawn sh ENOENT
npm ERR!
npm ERR! Failed at the chromedriver@2.45.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! /home/apps/.npm/_logs/2019-01-10T08_56_31_144Z-debug.log

/home/apps/.npm/_logs/2019-01-10T08_56_31_144Z-debug.log

2411 silly saveTree |   +-- debug@4.1.0
2411 silly saveTree |   | `-- ms@2.1.1
2411 silly saveTree |   `-- is2@2.0.1
2411 silly saveTree |     +-- deep-is@0.1.3
2411 silly saveTree |     +-- ip-regex@2.1.0
2411 silly saveTree |     `-- is-url@1.2.4
2411 silly saveTree `-- rimraf@2.6.3
2412 verbose stack Error: chromedriver@2.45.0 install: `node install.js`
2412 verbose stack spawn sh ENOENT
2412 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
2412 verbose stack     at onErrorNT (internal/child_process.js:362:16)
2412 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:139:11)
2412 verbose stack     at process._tickCallback (internal/process/next_tick.js:181:9)
2413 verbose pkgid chromedriver@2.45.0
2414 verbose cwd /data/codebase/1_2_20190110_165624
2415 verbose Linux 3.10.0-327.el7.x86_64
2416 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "chromedriver"
2417 verbose node v8.15.0
2418 verbose npm  v6.4.1
2419 error file sh
2420 error path sh
2421 error code ELIFECYCLE
2422 error errno ENOENT
2423 error syscall spawn sh
2424 error chromedriver@2.45.0 install: `node install.js`
2424 error spawn sh ENOENT
2425 error Failed at the chromedriver@2.45.0 install script.
2425 error This is probably not a problem with npm. There is likely additional logging output above.
2426 verbose exit [ 1, true ]

logs/error.log

Traceback (most recent call last):
  File "/wwwroot/deploy.corp.freshjn.com/walle/service/waller.py", line 58, in run
    raise Exception(stderr)
Exception: [..................] / rollbackFailedOptional: verb npm-session e753c6d69eeb403
[..................] / rollbackFailedOptional: verb npm-session e753c6d69eeb403
[..................] - fetchMetadata: sill resolveWithNewModule chromedriver@2.
[..................] - fetchMetadata: sill resolveWithNewModule request@2.88.0
[..................] \ fetchMetadata: sill resolveWithNewModule rimraf@2.6.3 ch
[..................] \ fetchMetadata: sill resolveWithNewModule path-is-absolut
[..................] \ fetchMetadata: sill resolveWithNewModule balanced-match@
[ .................] | fetchMetadata: sill resolveWithNewModule is-path-inside@
[ .................] - fetchMetadata: sill resolveWithNewModule readable-stream
[ .................] \ fetchMetadata: sill resolveWithNewModule ms@2.0.0 checki
[  ................] | fetchMetadata: sill resolveWithNewModule pend@1.2.0 chec
[  ................] \ fetchMetadata: sill resolveWithNewModule pend@1.2.0 chec
[  ................] | loadDep:mime-types: sill resolveWithNewModule delayed-st
[  ................] | fetchMetadata: sill resolveWithNewModule mime-db@1.37.0
[  ................] / fetchMetadata: sill resolveWithNewModule punycode@2.1.1
[  ................] / fetchMetadata: sill resolveWithNewModule punycode@2.1.1
[  ................] | fetchMetadata: sill resolveWithNewModule extsprintf@1.3.
[   ...............] | fetchMetadata: sill resolveWithNewModule psl@1.1.31 chec
[   ...............] \ fetchMetadata: sill resolveWithNewModule ms@2.1.1 checki
[       ...........] \ extract:chromedriver: verb lock using /home/apps/.npm/_l
[         .........] \ extract:isstream: sillextract bcrypt-pbkdf@1.0.2
[            ......] | finalize:isarray: sill ract sshpk@^1.7.0 extracted to /d
[            ......] / refresh-package-json:pify: driver: timing action:finaliz
npm WARN lifecyc
e npm is using /usr/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` op
tion to include the path for the node binary npm was executed with.

> chromedriver@2.45.0 install /data/codebase/1_2_20190110_165624/node_modules/chromedriver
> node install.js

npm ERR! file sh
npm ERR! path sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn sh
npm ERR! chromedriver@2.45.0 install: `node install.js`
npm ERR! spawn sh ENOENT
npm ERR! 
npm ERR! Failed at the chromedriver@2.45.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging out
put above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/apps/.npm/_logs/2019-01-10T08_56_31_144Z-debug.log

截图 拖拽到此处即可上传

运行环境

jokechat commented 5 years ago

https://www.npmjs.com/package/chromedriver#custom-binaries-url

chromedriver下载失败,我之前也遇到到,你可以在执行命令的用户下指定从国内下载或者指定路径即可

jokechat commented 5 years ago

https://github.com/giggio/node-chromedriver/blob/master/install.js

附上node install.js 执行的脚本

jeftom commented 5 years ago

https://www.npmjs.com/package/chromedriver#custom-binaries-url

chromedriver下载失败,我之前也遇到到,你可以在执行命令的用户下指定从国内下载或者指定路径即可

谢谢,我已经指定了 taobao 的地址的,手工在shell窗口执行是正常的,用 walle 调用时才报。

mvpleung commented 5 years ago

请问你这个问题解决了没

kun376361 commented 5 years ago

我这边也是遇到了这个问题,同样的命令放在shell上是可以的,用walle就不行,如果手动执行cnpm install以后,walle这一步就不报错了,但是到build的时候还是会报错,shell上是正常的。

justrustc commented 5 years ago

我也是build的时候报错了

nanjixiong218 commented 5 years ago

我遇到的是npm not found, PATH里已经把node的bin目录加进去了;必须要在/usr/bin里要添加软链才行; 添加了软链接,npm run build还是报错 ,总说spawn sh ENOENT

ksh033 commented 5 years ago

我也是 npm run build还是报错 ,总说spawn sh ENOENT; 我自己测试了一下local方法 fabric2 Connection local connection .local("cd /tmp/walle/codebase/1 && npm run build",pty=True, warn=True, watchers=[say_yes()]) 提示spawn sh ENOENT; 下面这个就不会 ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(HOST,22,USERNAME,PASSWORD,timeout=5) stdin, stdout, stderr = ssh.exec_command("cd /tmp/walle/codebase/1 && npm run build")

akwolf commented 5 years ago

同问,看来这个问题出现的频率挺高 walle-python | [1/4] scripts.postinstall less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 run "node lib/post_install.js", root: "/opt/walle_home/codebase/3_5_20191108_113720/node_modules/_uglifyjs-webpack-plugin@0.4.6@uglifyjs-webpack-plugin" walle-python | [npminstall:runscript:error] less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 scripts.postinstall run "node lib/post_install.js" error: Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) { walle-python | errno: 'ENOENT', walle-python | code: 'ENOENT', walle-python | syscall: 'spawn sh', walle-python | path: 'sh', walle-python | spawnargs: [Array] walle-python | } ✖ Install fail! Error: post install error, please remove node_modules before retry! walle-python | spawn sh ENOENT walle-python | Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) walle-python | npminstall version: 3.23.0 walle-python | npminstall args: /root/node-v12.13.0-linux-x64/bin/node /root/node-v12.13.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/tmp/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org ⠴ [2/80] Installing delegate@^3.1.2[jspdf@1.5.3 › file-saver@github:eligrey/FileSaver.js#1.3.8] install file-saver from git github:eligrey/FileSaver.js#1.3.8, may be very slow, please keep patience ⠧ [34/80] Installing regjsparser@^0.1.4platform unsupported less-loader@4.1.0 › webpack@3.12.0 › watchpack@1.6.0 › chokidar@2.1.8 › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(linux) ⠇ [34/80] Installing postcss-discard-unused@^2.2.1[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(linux) ✔ Installed 80 packages ✔ Linked 1077 latest versions walle-python | [1/4] scripts.postinstall less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 run "node lib/post_install.js", root: "/opt/walle_home/codebase/3_5_20191108_113720/node_modules/_uglifyjs-webpack-plugin@0.4.6@uglifyjs-webpack-plugin" walle-python | [npminstall:runscript:error] less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 scripts.postinstall run "node lib/post_install.js" error: Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) { walle-python | errno: 'ENOENT', walle-python | code: 'ENOENT', walle-python | syscall: 'spawn sh', walle-python | path: 'sh', walle-python | spawnargs: [Array] walle-python | } ✖ Install fail! Error: post install error, please remove node_modules before retry! walle-python | spawn sh ENOENT walle-python | Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) walle-python | npminstall version: 3.23.0 walle-python | npminstall args: /root/node-v12.13.0-linux-x64/bin/node /root/node-v12.13.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/tmp/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org walle-python | walle-python | Traceback (most recent call last): walle-python | File "/opt/walle_home/walle/service/waller.py", line 58, in run walle-python | raise Exception(stderr) ⠴ [2/80] Installing delegate@^3.1.2[jspdf@1.5.3 › file-saver@github:eligrey/FileSaver.js#1.3.8] install file-saver from git github:eligrey/FileSaver.js#1.3.8, may be very slow, please keep patience ⠧ [34/80] Installing regjsparser@^0.1.4platform unsupported less-loader@4.1.0 › webpack@3.12.0 › watchpack@1.6.0 › chokidar@2.1.8 › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(linux) ⠇ [34/80] Installing postcss-discard-unused@^2.2.1[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(linux) ✔ Installed 80 packages ✔ Linked 1077 latest versions walle-python | [1/4] scripts.postinstall less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 run "node lib/post_install.js", root: "/opt/walle_home/codebase/3_5_20191108_113720/node_modules/_uglifyjs-webpack-plugin@0.4.6@uglifyjs-webpack-plugin" walle-python | [npminstall:runscript:error] less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 scripts.postinstall run "node lib/post_install.js" error: Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) { walle-python | errno: 'ENOENT', walle-python | code: 'ENOENT', walle-python | syscall: 'spawn sh', walle-python | path: 'sh', walle-python | spawnargs: [Array] walle-python | } ✖ Install fail! Error: post install error, please remove node_modules before retry! walle-python | spawn sh ENOENT walle-python | Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) walle-python | npminstall version: 3.23.0 walle-python | npminstall args: /root/node-v12.13.0-linux-x64/bin/node /root/node-v12.13.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/tmp/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org walle-python | ⠴ [2/80] Installing delegate@^3.1.2[jspdf@1.5.3 › file-saver@github:eligrey/FileSaver.js#1.3.8] install file-saver from git github:eligrey/FileSaver.js#1.3.8, may be very slow, please keep patience ⠧ [34/80] Installing regjsparser@^0.1.4platform unsupported less-loader@4.1.0 › webpack@3.12.0 › watchpack@1.6.0 › chokidar@2.1.8 › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(linux) ⠇ [34/80] Installing postcss-discard-unused@^2.2.1[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(linux) ✔ Installed 80 packages ✔ Linked 1077 latest versions walle-python | [1/4] scripts.postinstall less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 run "node lib/post_install.js", root: "/opt/walle_home/codebase/3_5_20191108_113720/node_modules/_uglifyjs-webpack-plugin@0.4.6@uglifyjs-webpack-plugin" walle-python | [npminstall:runscript:error] less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 scripts.postinstall run "node lib/post_install.js" error: Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) { walle-python | errno: 'ENOENT', walle-python | code: 'ENOENT', walle-python | syscall: 'spawn sh', walle-python | path: 'sh', walle-python | spawnargs: [Array] walle-python | } ✖ Install fail! Error: post install error, please remove node_modules before retry! walle-python | spawn sh ENOENT walle-python | Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) walle-python | npminstall version: 3.23.0 walle-python | npminstall args: /root/node-v12.13.0-linux-x64/bin/node /root/node-v12.13.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/tmp/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org walle-python | walle-python | Traceback (most recent call last): walle-python | File "/opt/walle_home/walle/service/waller.py", line 58, in run walle-python | raise Exception(stderr) ⠴ [2/80] Installing delegate@^3.1.2[jspdf@1.5.3 › file-saver@github:eligrey/FileSaver.js#1.3.8] install file-saver from git github:eligrey/FileSaver.js#1.3.8, may be very slow, please keep patience ⠧ [34/80] Installing regjsparser@^0.1.4platform unsupported less-loader@4.1.0 › webpack@3.12.0 › watchpack@1.6.0 › chokidar@2.1.8 › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(linux) ⠇ [34/80] Installing postcss-discard-unused@^2.2.1[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(linux) ✔ Installed 80 packages ✔ Linked 1077 latest versions walle-python | [1/4] scripts.postinstall less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 run "node lib/post_install.js", root: "/opt/walle_home/codebase/3_5_20191108_113720/node_modules/_uglifyjs-webpack-plugin@0.4.6@uglifyjs-webpack-plugin" walle-python | [npminstall:runscript:error] less-loader@4.1.0 › webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 scripts.postinstall run "node lib/post_install.js" error: Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) { walle-python | errno: 'ENOENT', walle-python | code: 'ENOENT', walle-python | syscall: 'spawn sh', walle-python | path: 'sh', walle-python | spawnargs: [Array] walle-python | } ✖ Install fail! Error: post install error, please remove node_modules before retry! walle-python | spawn sh ENOENT walle-python | Error: spawn sh ENOENT walle-python | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) walle-python | at onErrorNT (internal/child_process.js:456:16) walle-python | at processTicksAndRejections (internal/process/task_queues.js:80:21) walle-python | npminstall version: 3.23.0 walle-python | npminstall args: /root/node-v12.13.0-linux-x64/bin/node /root/node-v12.13.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/tmp/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org

anota commented 4 years ago

@nanjixiong218 我发现是环境变量的问题。 我这边通过设置PATH解决了 自己登录ssh后echo $PATH 查看下具体值,然后在walle后台附上系统环境变量就可以了, 例如我的PATH=/home/tomcat/.nvm/versions/node/v8.16.2/bin:/usr/local/jdk1.8/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/tomcat/.local/bin:/home/tomcat/bin