每次我部署develop
分支时,都会遇到以下问题:
From github.com:foo/bar
75be85b..07d10bb develop -> origin/develop
error: Your local changes to the following files would be overwritten by merge:
package-lock.json
Please commit your changes or stash them before you merge.
Aborting
我的解决方案(但这不是永久性的)
我SSH进入服务器并在项目的根目录中键入:
git checkout HEAD -- package-lock.json
然后,当我再次部署时,问题消失了,但是每次我合并新分支以进行开发并尝试再次部署时,问题都会再次出现。
问题出在我的package-lock.json
还是我的部署脚本中?如何永久解决此问题?
git merge // <- I assume it fails on this line
composer dump-autoload -o
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan migrate --force
php artisan clear-compiled
php artisan view:cache
php artisan config:clear
php artisan config:cache
php artisan optimize
npm install
npm run production
php artisan queue:restart
答案 0 :(得分:0)
使用npm ci
,它不要修改package-lock.json,并且npm install
要做在模块上获得新的次要版本时进行修改
npm help ci中的一些信息副本
In short, the main differences between using npm install and npm ci are:
· The project must have an existing package-lock.json or npm-shrinkwrap.json.
· If dependencies in the package lock do not match those in package.json,
npm ci will exit with an error, instead of updating the package lock.
· npm ci can only install entire projects at a time:
individual dependencies cannot be added with this command.
· If a node_modules is already present, it will be automatically
removed before npm ci begins its install.
· It will never write to package.json or any of the package-locks:
installs are essentially frozen.