2017-02-16 5 views
1

다른 node_modules가있는 다른 로컬 시스템에서 프로덕션의 내 node_modules이 엉망이되었습니다. 이제 I git pull origin master 생산에 다음과 같은 메시지가 표시 될 때마다 :Git for Production에서 병합 오류가 발생했습니다.

[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 폴더를 제거 그것의 repo에서 제거하지만 컴퓨터에 여전히 지역. 그런 다음 .gitignore에 넣고 몇 가지 변경 사항을 적용하거나 배포 시스템을 사용하여 변경 사항을 배포 할 때 install 명령을 실행하는 스크립트를 작성하십시오.