为什么可以在nodejs上应用node_modules / or / node_modules之后,将.gitignore隐藏node_module文件。
我的.gitignore文件与.git文件夹
尽管它隐藏了我的.env文件。 但是gitignore仍然不隐藏我的node_modules文件夹
更新了.gitignore文件> NPM安装。仍然行不通。我现在该怎么办?
My .gitignore file is on as the same root as .git folder
i have also tried out different format like 'node_modules/' '/node_modules'
though it's hiding my .env file.
But gitignore still not hiding my node_modules folder
I have also tried by uninstalling the node_modules > updated the .gitignore file > npm install. Still it doesn't work. What should i do now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用 node_modules/*
这将告诉git忽略节点模块文件夹中的所有文件和文件夹。
另外,请确保通过添加依赖关系并使用命令来检查它,
它将为您提供所有更改的文件的列表。
Try using node_modules/*
This will tell git to ignore all files and folders inside the node modules folder.
Also make sure to check it by adding a dependency and using the command
It will give you a list of all changed files.
我也正在发生同样的问题,但是我必须使用的解决方案是,当命令
git添加。
将我们的node_modules
将其与其他文件一起放到stating区域时,之后,只需使用git命令:之后,您可以通过
git状态
检查。The same issue is happening with me also, But the solution which I have to use is that, when command
git add .
put ournode_modules
to statging area also with other files, after that just use the git command:After this, you can check by
git status
.可能是因为您的git存储库已经在跟踪您的“ node_modules”文件夹。尝试删除文件夹并进行更改,然后用
npm i
重新安装您的节点模块。然后,该文件夹应保持未跟踪,并将在VS代码中显示为灰色。It may be because your git repository is already tracking your 'node_modules' folder. Try removing the folder and commiting the change, then reinstall your node modules with
npm i
. The folder should then remain untracked and will appear greyed out in VS Code.