Angular / CLI未正确安装

时间:2018-07-26 12:37:23

标签: angular angular-cli

当我安装angular / cli时,我得到以下信息:

$ npm install  @angular/cli

npm WARN saveError ENOENT: no such file or directory, open 
'sandbox2\package.json'
npm WARN enoent ENOENT: no such file or directory, open 
'sandbox2\package.json'
npm WARN sandbox2 No description
npm WARN sandbox2 No repository field.
npm WARN sandbox2 No README data
npm WARN sandbox2 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"win32","arch":"x64"})

这是上面安装方法的延续。我被迫在这里添加更多评论;

+ @angular/cli@6.1.0
updated 1 package in 54.164s
[!] 4 vulnerabilities found [22842 packages audited]
    Severity: 1 Low | 3 Moderate
    Run `npm audit` for more detail

然后创建项目失败:

$ ng new hd12
newTree.optimize is not a function

1 个答案:

答案 0 :(得分:4)

问题是angular / cli的最新版本。 $ npm install @ angular / cli @ latest

使用的最后一个已知工作版本:  npm install --save-dev @ angular / cli @ 6.1.0-rc.0