jenkins打包部署之Cannot read property 'modulePath' of null

Shell命令配置

export TARGET_PATH=/www/wwwroot/retail/store
#第一次构建时需要install
#npm i
#执行构建
npm run build
#删除原构建文件
rm -f dist.tar.gz
#压缩文件
tar -czf dist.tar.gz dist
#移动文件到目标路径
cp dist.tar.gz $TARGET_PATH/
#执行部署操作
sh $TARGET_PATH/deploy.sh

问题描述

部署时,报如下错误

  • Building for production…
    ERROR TypeError: Cannot read property ‘modulePath’ of null
    TypeError: Cannot read property ‘modulePath’ of null


    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! cube-ui-party-v@0.1.0 build: vue-cli-service build
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the cube-ui-party-v@0.1.0 build 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! /root/.npm/_logs/2020-03-04T09_33_33_736Z-debug.log
Build step ‘Execute shell’ marked build as failure
Finished: FAILURE

原因分析

项目中,增加一个复制粘贴的功能,引入了clipboard.js,而node_module中没有对应的modulePath,因为npm i 被我注释掉了,部署时,没有npm install clipboard --save

问题解决

shell中解除 npm i 的注释,重新生成node_module
以目前的水平,只能想到这种解决方式,欢迎各位大佬如有更便捷的方式,请交流指正。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值