【问题标题】:Why can't I create new project using "ng new" syntax为什么我不能使用“ng new”语法创建新项目
【发布时间】:2017-04-04 11:44:27
【问题描述】:

节点版本 v7.0.0

npm 版本 v3.10.8

我在 C:\

上安装“npm install -g angular-cli”

并在 C:\newfolder 上创建新项目,但不幸的是我收到了这个错误:

C:\ang>ng new app
module.js:474
    throw err;
    ^

Error: Cannot find module 'C:\Users\Cindy\AppData\Roaming\npm\node_modules\angular-cli\bin\ng'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.runMain (module.js:607:10)
    at run (bootstrap_node.js:382:7)
    at startup (bootstrap_node.js:137:9)
    at bootstrap_node.js:497:3

【问题讨论】:

    标签: node.js angular npm angular-cli


    【解决方案1】:

    我也尝试过这样做,结果发现将节点更新为v7.0.0 是原因。

    据我了解

    Node 7 存在一些绑定问题。它无法在我的系统中找到绑定。

    卸载它并安装节点 6.* 有帮助。

    按照以下步骤操作:

    卸载节点 v7。

    删除AppData/Roaming/ 中的npmnpm cache 目录。

    安装节点版本 6.9。

    运行npm cache clean

    & 然后全局安装 angular-cli。

    如果您愿意,可以在以下位置跟踪问题:

    Github Link For this particular Issue.

    希望对你有帮助

    【讨论】:

    • 我按照您给出的步骤进行操作,但不幸的是我无法安装 angular-cli。 .
    • 安装“npm install -g angular-cli”的正确路径是什么?
    • 在 Windows 上,它是 C:\\users\username\AppData\Roaming\npm。你可以在任何地方安装它。只需指定 -g as` npm install -g angular-cli` 这将安装它在全球范围内。
    猜你喜欢
    • 1970-01-01
    • 2018-04-19
    • 2019-02-28
    • 2016-06-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-28
    • 1970-01-01
    • 2021-10-25
    相关资源
    最近更新 更多