赞
踩
env: node: No such file or directory
env: node: No such file or directory
的问题
本地执行 env获取 手动执行的环境
在脚本中 添加 env > /tmp/env.log
对比:
本地中的环境
TERM_SESSION_ID=w0t0p0:B13A6A43-7378-415D-A34D-410B54F38998 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.9pNWdDeUfe/Listeners LC_TERMINAL_VERSION=3.4.22 COLORFGBG=7;0 ITERM_PROFILE=Default XPC_FLAGS=0x0 LANG=zh_CN.UTF-8 PWD=/Users/pengzhanliang/go/src/pop-develop-global-server SHELL=/bin/zsh __CFBundleIdentifier=com.googlecode.iterm2 TERM_PROGRAM_VERSION=3.4.22 TERM_PROGRAM=iTerm.app PATH=/var/www/91ke:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/Cellar/openssl/1.0.2s/bin:/usr/local/Cellar/php/8.1.12/bin/sbin:/usr/local/Cellar/php/8.1.12/bin:/usr/local/opt/coreutils/libexec/gnubin:/Users/pengzhanliang/Library/Python/3.9/bin:/usr/local/opt/go@1.16/bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/Cellar/redis@3.2/3.2.13/bin:/usr/local/Cellar/php@7.1/7.1.33/sbin:/usr/local/Cellar/php@7.1/7.1.33/bin:/libexec/gnubin:/var/www/91ke:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/Cellar/openssl/1.0.2s/bin:/usr/local/Cellar/php/8.1.12/bin/sbin:/usr/local/Cellar/php/8.1.12/bin:/usr/local/opt/coreutils/libexec/gnubin:/Users/pengzhanliang/Library/Python/3.9/bin:/usr/local/opt/go@1.16/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/Users/pengzhanliang/go/bin:/usr/local/Cellar/mongodb-community@3.2/3.2.22/bin:/Users/pengzhanliang/go/bin:/usr/local/Cellar/mongodb-community@3.2/3.2.22/bin LC_TERMINAL=iTerm2 COLORTERM=truecolor COMMAND_MODE=unix2003 TERM=xterm-256color HOME=/Users/pengzhanliang TMPDIR=/var/folders/pm/8qhqb_zn4bgg6hw9mv9thck80000gn/T/ USER=pengzhanliang XPC_SERVICE_NAME=0 LOGNAME=pengzhanliang ITERM_SESSION_ID=w0t0p0:B13A6A43-7378-415D-A34D-410B54F38998 __CF_USER_TEXT_ENCODING=0x0:25:52 SHLVL=1 OLDPWD=/Users/pengzhanliang/go/src GO111MODULE=on GOPROXY=https://mirrors.tencent.com/go/ GOPATH=/Users/pengzhanliang/go GOBIN=/Users/pengzhanliang/go/bin GOPRIVATE=gitlab.paquapp.com GONOPROXY=gitlab.paquapp.com GONOSUMDB=gitlab.paquapp.com LDFLAGS=-L/usr/local/Cellar/openssl/1.0.2s/lib
很多很多,两者相差很大,需要手动添加需要的环境
脚本中的环境
- SHELL=/bin/sh
- OLDPWD=/Users/pengzhanliang/go/src/runing
- USER=pengzhanliang
- PATH=/usr/bin:/bin
- PWD=/Users/pengzhanliang/go/src/runing
- HOME=/Users/pengzhanliang
- SHLVL=2
- LOGNAME=pengzhanliang
- _=/usr/bin/env
比如,我需要 node环境就添加:
export PATH="/usr/local/bin:$PATH"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。