After pulling the code, npm i prompts that the code has changed 9999+ because the code repository was created and the node_modules file was submitted to the git repository.

As shown in the figure: Pull down the warehouse code and download the dependency package npm i. The display changes are 9999+. When you open it, you will find that they are all related to the node_modules file.

Here is my detailed solution:

Step one: First write node_modules/ in the .gitignore file in the root directory , ensure that the node_module folder is excluded from the next submission

The purpose of the .gitignore file is to add file names that need to be ignored. I have also written other files here, and you can add them as needed. Notenode_module is a folder, be sure to add a / slash at the end, otherwise it will be invalid

Step 2: Delete node_modules from git tracking, the command is as followsgit rm -r --cached node_modules (To perform this step is Because node_modules already exists in the remote code warehouse, if the remote code warehouse does not have node_modules, you do not need to do this step)

Step 3: Resubmit

git add . 
git commit -m'remove node_modules文件夹'
git push 

This problem is solved! The node_modules file in the code warehouse has also been deleted, and subsequent updates will not push node_modules up again.

Guess you like

Origin blog.csdn.net/weixin_73318685/article/details/132880728