简体   繁体   English

无法使用ng new命令创建项目

[英]Cant create project using the ng new command

I'm trying to create an Angular project using the command 我正在尝试使用以下命令创建一个Angular项目

ng new my

The creation starts but the get stuck at some point and never ends. 创作开始了,但是陷入了困境,直到永远。 I get the following terminal outputs, 我得到以下终端输出,

Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
installing ng2
  create .editorconfig
  create README.md
  create src/app/app.component.css
  create src/app/app.component.html
  create src/app/app.component.spec.ts
  create src/app/app.component.ts
  create src/app/app.module.ts
  create src/app/index.ts
  create src/app/shared/index.ts
  create src/assets/.gitkeep
  create src/assets/.npmignore
  create src/environments/environment.prod.ts
  create src/environments/environment.ts
  create src/favicon.ico
  create src/index.html
  create src/main.ts
  create src/polyfills.ts
  create src/styles.css
  create src/test.ts
  create src/tsconfig.json
  create src/typings.d.ts
  create angular-cli.json
  create e2e/app.e2e-spec.ts
  create e2e/app.po.ts
  create e2e/tsconfig.json
  create .gitignore
  create karma.conf.js
  create package.json
  create protractor.conf.js
  create tslint.json
Successfully initialized git.
Installing packages for tooling via npm.

After the last line, it stops forever and I quit after providing 10 minutes of time. 最后一行之后,它将永远停止,我在提供10分钟的时间后退出。 Though the files are generated properly and when I run ng server I get the errors, 尽管文件生成正确,当我运行ng server ,出现错误,

1st time: it count find the portfinder 
2nd time:  module.js:327
    throw err;
    ^
Error: Cannot find module 'ember-cli/lib/cli'

I assume I need to provide more time to Installing packages for tooling or is there something else. 我认为我需要花更多的时间来Installing packages for tooling否则还有其他问题。 This is the first time I use Angular and hence, slightly confused about the issue. 这是我第一次使用Angular ,因此对此问题有些困惑。 Thanks. 谢谢。

EDIT:

I again tried and waits long enough to get the following error message, 我再次尝试并等待了足够长的时间才能收到以下错误消息,

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package @angular/compiler@2.1.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/compiler-cli@0.6.4 wants @angular/compiler@2.0.2
npm ERR! peerinvalid Peer @angular/platform-server@2.1.0 wants @angular/compiler@2.1.0

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Chaklader/Desktop/my/npm-debug.log

Package install failed, see above.

WHAT SHOULD I DO TO RESOLVE THE ISSUE? 我应该怎么解决这个问题?

You can follow the next steps and solve your problem: 您可以按照以下步骤解决问题:

  1. In old version of angular-cli you just use ng new App --skip-npm to avoid install. 在旧版本的angular-cli您只需使用ng new App --skip-npm即可避免安装。 For latest version you can use ng new App --skip-install instead; 对于最新版本,您可以改用ng new App --skip-install ;
  2. Get into the directory use cd App and and then installed npm via npm install . 使用cd App进入目录,然后通过npm install安装npm。
  3. Wait for minutes to let the installation to complete. 等待几分钟,以完成安装。 With using CLI , here is how to compile and run it ng serve . 使用CLI ,这里是如何编译和运行ng serve

I solved the problem with reference to this solution-angular-ng-new-command-stuck-at-installing-packages-for-tooling-via-npm . 我参考此解决方案解决了这个问题-ng-ng-new-command-stuck-at-installing-packages-for-tooling-via-npm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM