简体   繁体   中英

is it safe to uploud np-modules folder in react native project to github?

whenever I sync a react native project in GitHub , GitHub ignores the npm-modules folder to sync.I was wondering why GitHub has this approach, is there any problem to include this folder in our GitHub project? I know there is ignore line in GitHub for this folder and also I know I can easily install npm module but sometimes you need to change some parts directly from library and those modifications cannot be install again by npm install.

Github doesn't ignore anything, it is basically the same as git and it doesn't understand the structure of a react-native project.

The folder is ignored because it's in the .gitignore created by the react-native CLI.

To include nodes_modules in your git, just remove the line node_modules/ in your .gitignore and add/commit. You'll then be able to push your node_modules.

Uploading the node_modules folder is basically safe, but most people ignore it because you can generate it by npm install . That's why react-native put it in the default .gitignore.

See also Should "node_modules" folder be included in the git repository for whether you should include this folder or not.

Answer to the edit:

I know there is ignore line in GitHub for this folder and also I know I can easily install npm module but sometimes you need to change some parts directly from library and those modifications cannot be install again by npm install.

(It's not Github, it would be the same with another git server.)

If you decide not to include node_modules, and want to change a library, you can fork the library on Github and install your fork with npm: npm install <yourUsername>/<yourRepository> (if it's public).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM