'ember new' 命令在初始化 git 后失败。哪里有详细的日志可以看?

'ember new' command fails after initializing git. Are there detailed logs anywhere to look at?

我是 ember.js、node 和 npm 的新手。我在使用 'ember new my-project' 命令时 运行 遇到问题。我强烈怀疑我通过不正确的安装搞砸了目录权限或其他东西,但我不知道最好的调查方法。

环境如下:AWS EC2实例,ubuntu16.04,nodejs 7.5.0,npm 4.2.0,bower 1.8.0,ember-cli 2.11.1.

npm、bower、ember 是使用 -g 安装的,而不是像 ember.js 文档推荐的那样使用 sudo。

当我 运行 'ember new my-project' 命令时,我得到 "Successfully initialized git" 然后我得到

Error creating new application. Removing generated directory `./my-project`
Command failed: /home/ubuntu/.npm-global/lib/node_modules/ember-cli/node_modules/npm/bin/npm-cli.js install --no-optional --loglevel error
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

当我 运行 ~ $ npm ls minimatch 检查错误的最小匹配部分时,我没有看到任何模块需要 2.0.10,所以我不确定它来自哪里。我也不确定这是否真的是导致整个事情失败的原因。

我也试过 运行ning npm install -g minimatch@3.0.2 但如你所见,只是把它放在 npm@4.2.0 树之外。

/home/ubuntu
├── minimatch@3.0.2
└─┬ npm@4.2.0
  ├─┬ fstream-npm@1.2.0
  │ └─┬ fstream-ignore@1.0.5
  │   └── minimatch@3.0.3
  ├─┬ glob@7.1.1
  │ └── minimatch@3.0.3
  ├─┬ init-package-json@1.9.4
  │ └─┬ glob@6.0.4
  │   └── minimatch@3.0.3
  ├─┬ node-gyp@3.5.0
  │ └── minimatch@3.0.3
  └─┬ read-package-json@2.0.4
    └─┬ glob@6.0.4
      └── minimatch@3.0.3

到目前为止我尝试过的基本上是玩版本 - 删除和重新安装 nodejs 和 npm,使用不同的版本(文档和 google 推荐不同版本的节点和 npm 用于 ember-cli.. 我尝试了节点 4.0.0 和 npm 2.x.x 和 3.x.x)

我还尝试使用 ember-cli 2.11.0,因为该版本在我的本地 VM 中正常工作,并且 运行 使用 'sudo' 命令。

是否有更详细的 npm 或 ember-cli 错误日志我可以查看? 有人能给我指出正确的方向来弄清楚这里发生了什么吗?

您可以 运行 ember new 使用 DEBUG 选项:

DEBUG=* ember new projectname

这将生成大量 输出,但它应该可以帮助您找出中断的位置。

感谢@Jure C. 提供了我提出的问题的答案,我找到了手头问题的答案,对于任何发现此问题的人:

从他的回答中我得到以下信息:"Running 'ember new my-project --skip-npm ; cd my-project ; npm install' reveals more information... npm install is hanging each time while extracting libraries and being killed - and NOT in the same place every time"

这让我相信这是一个奇怪的系统资源 and/or 超时问题或某种原因,而不是权限或代码问题。

出错了:

1) 似乎有一个本地(而不是全局)安装的 npm 版本搞砸了。不确定我什么时候这样做的,但这是一个很大的问题。从哪里删除它并不是非常直观,但最终我用谷歌搜索了它,它帮助这个过程走得更远。

2) 原来可怜的小 AWS 实例不能胜任这项任务!

ulimit -n 2048

可能有点矫枉过正,但允许 npm install 的所有提取过程在终止之前完成。