h5 端在本地 dev 以及 build 都没问题,在 jenkins 上报错
报错一
找不到依赖包
解决 :将本地 node_modules
压缩后放在服务器上相应文件解压。这里还有另一个问题就是服务器上 node
版本太低了,前面降级之后还是存在依赖包找不到问题
报错二
cross-env: Permission denied
上面代码是我从网上截取的,不过问题都是一样。应该是由手动在服务器上增加的 node_modules
引起。
解决
// 执行如下命令 在执行打包命令
npm rebuild
该报错信息相干文章连贯
sh: 1: cross-env: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the @ development 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/shanmaseen/.npm/_logs/2019-02-22T16_32_08_191Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the @ dev 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/shanmaseen/.npm/_logs/2019-02-22T16_32_08_241Z-debug.log
因为是手动增加的 node_modules
在 jenkins
上配置构建命令时 不须要再进行 install
间接执行 rebuild
在进行 build
npm rebuild
npm run build
ls -al
scp -r ./dist/build/h5/* < 你的服务器文件门路 >