加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 为什么node_modules文件夹没有提交到Git?

发布时间:2020-12-17 09:27:59 所属栏目:安全 来源:网络整理
导读:当我创建一个AngularJS项目时 yo angular 它创建一个node_modules /目录,但将该目录放在.gitignore中.当我将项目克隆到其他地方并运行时 grunt server 我得到 Fatal error: Unable to find local grunt. If you’re seeing this message,either a Gruntfile
当我创建一个AngularJS项目时
yo angular

它创建一个node_modules /目录,但将该目录放在.gitignore中.当我将项目克隆到其他地方并运行时

grunt server

我得到

Fatal error: Unable to find local grunt.

If you’re seeing this message,either a Gruntfile wasn’t found or
grunt hasn’t been installed locally to your project. For more
information about installing and configuring grunt,please see the
Getting Started guide:

入门指南并没有说明如何处理丢失的node_modules /目录.

node_modules /目录被故意地丢失,因为你们把它放在.gitignore中.

在这种情况下,使用Yeoman和Grunt的正确方法是什么?
Yeoman和Grunt有没有更好的文档?

谢谢.

这是正确的行为. node_modules的内容不是要提交到源代码控制. npm后面的想法是它跟踪一个名为 package.json的文件中的所有节点依赖关系.该文件应该被提交到源代码控制.然后在另一台机器上,您可以查看代码并运行

npm安装

这看看package.json文件,并从云中下载所有需要的文件,并将它们全部放入一个新的node_modules目录中.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读