安装angular-cli

时间:2017-09-08 19:54:20

标签: node.js angular npm angular-cli

角度对我来说很新,英语不是我的第一语言所以我提前道歉。 我是学生,我必须使用MEAN平台做一个应用程序。我们从未使用任何MEAN组件或大学中的javascript,但现在我必须完成这个项目。我按照本教程 - > https://www.youtube.com/watch?v=wtIvu085uU0&list=PLTPtZWpWLI00vlAPQnDt8OlPwoYxuMCQo&index=4以及视频中长达45分钟的所有内容都运行得很好。在45分钟它说我必须安装@angular/cli但我第一次这样做时出错了。然后我尝试再次输入npm install @angular/cli,然后没有错误。这就像它应该是的,就像它在视频中一样。但是,当我输入ng new client时,它说

ng is not recognized as an internal or external command, operable program or batch file.

我不知道该怎么做,我试图再次安装angular-cli几次,但每次都是一样的。我绝望了。

版本:

  

node --version = v6.11.3

     

npm --version = 3.10.10

Windows 10

我输入" npm install @ angular / cli"时得到的错误:

npm ERR! tarball.destroy is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! github
npm WARN retry will retry, error on last attempt: Error: EBUSY: resource busy or locked, rename 'C:\Users\Loran\AppData\Local\Temp\npm-9616-ee3846a1\registry.npmjs.org\eventemitter3-\eventemitter3-1.2.0.tgz.1057597416' -> 'C:\Users\Loran\AppData\Local\Temp\npm-9616-ee3846a1\registry.npmjs.org\eventemitter3-\eventemitter3-1.2.0.tgz'
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "@angular/cli"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10

npm ERR! tarball.destroy is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! github
kontakti@1.0.0 D:\Project\kontakti
`-- @angular/cli@1.4.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN kontakti@1.0.0 No description
npm WARN kontakti@1.0.0 No repository field.
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "@angular/cli"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10

npm ERR! Callback called more than once.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! github

npm ERR! Please include the following file with any support request:
npm ERR! D:\Project\kontakti\npm-debug.log

2 个答案:

答案 0 :(得分:0)

对于这些版本:

  

node --version = v6.11.3

     

npm --version = 3.10.10

您应该尝试使用Angular CLI 4

$npm install -g @angular/cli@1.4

答案 1 :(得分:0)

要在终端中使用 ng 命令,您需要全局安装 Angular CLI

运行此命令安装:npm install -g @angular/cli