[2022-04-07 19:45:15] gyp WARN install got an error, rolling back install
[2022-04-07 19:45:15] gyp WARN install got an error, rolling back install
[2022-04-07 19:45:15] gyp ERR! configure error
[2022-04-07 19:45:15] gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/codingci/tools/jenkins_home/workspace/1231138-cci-18368145-239765/node_modules/node-rdkafka/.node-gyp'
[2022-04-07 19:45:15] gyp ERR! System Linux 5.4.119-1-tlinux4-0008
[2022-04-07 19:45:15] gyp ERR! command "/data/home/chuckma/.nvm/versions/node/v14.15.4/bin/node" "/data/home/chuckma/.nvm/versions/node/v14.15.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
[2022-04-07 19:45:15] gyp ERR! cwd /root/codingci/tools/jenkins_home/workspace/1231138-cci-18368145-239765/node_modules/node-rdkafka
原因:当前账户没有读写权限,只有root用户是具备读写权限的,其他都是只读。
解决:原npm
命令基础上加一句--unsafe-perm=true --allow-root
npm install --production --unsafe-perm=true --allow-root