【问题标题】:Restore a angular project after git checkoutgit checkout 后恢复 Angular 项目
【发布时间】:2019-01-11 15:36:22
【问题描述】:

我是 Angular 开发的新手。所以我有一个关于将存储在 Angular CLI 创建的 git 存储库中的数据的问题:实际上我用ng new helloworld 创建了一个新的 Angular 工作区。使用的 Angular CLI 版本是 7.2.1。它将创建一个 Git 存储库。在.gitignore 文件中有一堆条目。至今。使用ng new 命令,它会创建一些其他重要的东西,例如node_modules 文件夹。

现在的问题是:如果我签出这个 git 存储库,我将丢失 node_modules 文件夹。这件事的方法如何?如何自动创建添加必要的节点模块?我猜这个node_modules 文件夹的存储方式不是正确的,否则它就不是.gitignore 文件的条目...

【问题讨论】:

  • 在 git repo 中,如果你想在克隆运行命令npm i 后克隆你的项目,则无需添加 node_modules,它将根据你的项目添加所有 node_modules

标签: node.js angular git npm


【解决方案1】:

node_modules 的内容并不意味着提交给 git。它只包含 packages.json 文件中配置的项目包。结帐后,转到项目目录并运行

npm 安装

这将从云端下载所有必需的文件并填充一个新的 node_modules 目录。

【讨论】:

  • 我试过了,但这是我的终端输出第一行: > fsevents@1.2.4 install /Users/JMainol/Desktop/02-spa/node_modules/fsevents > node install node-pre-gyp WARN尝试下载(404):fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/… node-pre-gyp WARN 未找到 fsevents@1.2.4 和 node@12.16.1 的预构建二进制文件(node-v72 ABI,未知)(回退到使用节点编译的源代码-gyp) 在“/”处找不到“com.apple.pkg.CLTools_Executables”的收据。在“/”处找不到“com.apple.pkg.DeveloperToolsCLILeo”的收据。
  • 在“/”处找不到“com.apple.pkg.DeveloperToolsCLI”的收据。 gyp:未检测到 Xcode 或 CLT 版本!吉普错误!配置错误gyp ERR!堆栈错误:gyp 失败,退出代码:1 gyp ERR! ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16) gyp ERR 的堆栈! ChildProcess.emit (events.js:311:20) 的堆栈 gyp ERR!堆栈在 Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR!系统达尔文 19.4.0
猜你喜欢
  • 2021-10-03
  • 2019-01-24
  • 1970-01-01
  • 2015-08-19
  • 1970-01-01
  • 2014-04-18
  • 1970-01-01
  • 2020-10-09
  • 2023-03-03
相关资源
最近更新 更多