2017-02-16 64 views
1

生产上的我的node_modules被另一台具有不同node_modules的本地机器搞乱了。现在,每当I git pull origin master生产,以下消息显示:用于生产的Git搞砸了合并错误

[email protected]:~/proj$ git pull origin master 
Enter passphrase for key '/home/ubuntu/.ssh/id_rsa': 
From bitbucket.org:laics/proj 
* branch   master  -> FETCH_HEAD 
error: Your local changes to the following files would be overwritten by merge: 
     node_modules/gulp-autoprefixer/package.json 
     node_modules/gulp-complexity/package.json 
     node_modules/gulp-concat/package.json 
     node_modules/gulp-cssnano/node_modules/object-assign/package.json 
     node_modules/gulp-cssnano/package.json 
     node_modules/gulp-jsvalidate/node_modules/.bin/esparse 
     node_modules/gulp-jsvalidate/node_modules/.bin/esvalidate 
     node_modules/gulp-jsvalidate/node_modules/esprima/package.json 
     node_modules/gulp-jsvalidate/package.json 
     node_modules/gulp-less/node_modules/object-assign/package.json 
     node_modules/gulp-less/package.json 
     node_modules/gulp-ng-annotate/package.json 
     node_modules/gulp-notify/package.json 
     node_modules/gulp-rename/package.json 
     ......... 
     node_modules/gulp-shell/node_modules/lodash/isEmpty.js 
     node_modules/gulp-shell/node_modules/lodash/isError.js 
     node_modules/gulp-shell/node_modules/lodash/isFunction.js 
     node_modules/gulp-shell/node_modules/lo 
    Aborting 

它结束了,我想更新不更新的文件。

回答

2

问题是你不应该检查node_modules文件夹。否则,你有这个问题。通常你的服务器上有一个脚本在服务器上运行该命令。

因此,与

git rm --cached node_modules/ 

然后取出node_modules文件夹的从回购删除,但您的计算机上还是本地。然后将其放到您的.gitignore中,并编写一个脚本,在您执行一些更改时或者您使用部署系统部署更改时运行install命令。