直接使用cnpm报错,然后我通过ln -s在/usr/bin下创建了cnpm的软连接
jenkins中,shell如下
echo "运行cnpm install"
/usr/bin/cnpm install
echo "运行cnpm run build"
/usr/bin/cnpm run build
echo "构建成功"
报错如下
Started by user Andy
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/online-store
The recommended git tool is: NONE
using credential gitee-user-password
> git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/online-store/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://gitee.com/caoxuexi/online-store.git # timeout=10
Fetching upstream changes from https://gitee.com/caoxuexi/online-store.git
> git --version # timeout=10
> git --version # 'git version 1.8.3.1'
using GIT_ASKPASS to set credentials gitee的用户名和密码
> git fetch --tags --progress https://gitee.com/caoxuexi/online-store.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 0b281cdf38265b401ed788293cfce30106cbac01 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 0b281cdf38265b401ed788293cfce30106cbac01 # timeout=10
Commit message: "删除文件 dist"
> git rev-list --no-walk 0b281cdf38265b401ed788293cfce30106cbac01 # timeout=10
[online-store] $ /bin/sh -xe /tmp/jenkins5215932029698845276.sh
+ echo '运行cnpm install'
运行cnpm install
+ /usr/bin/cnpm install
/usr/bin/env: node: 没有那个文件或目录
Build step 'Execute shell' marked build as failure
Finished: FAILURE
顺带一提我用cnpm的原路径也是同样的错误
echo "运行cnpm install"
/root/tools/node-v14.17.0/bin/cnpm install
echo "运行cnpm run build"
/root/tools/node-v14.17.0/bin/cnpm run build
echo "构建成功"`