Angular CLI wont create new project

前端 未结 11 1236
有刺的猬
有刺的猬 2021-01-19 02:23

I am trying to create a project (named ngadmin) via the angular cli but it throws errors on this command: ng new ngadmin. The errors are:

相关标签:
11条回答
  • 2021-01-19 02:59

    In windows cd/User,Find the package.json,package-lock.json file and delete both the files.

    Restart your command prompt and you are ready to go.And try to use this command

    npm install --save-dev @angular/cli@latest

    0 讨论(0)
  • 2021-01-19 03:01

    The first warning regarding graceful-fs is due to the fact that angular-cli uses older version of graceful-fs pkg, nothing to worry about that.

    The error "You cannot use the new command inside an angular-cli project" signifies you are inside an angular cli project, get out of the angular cli project using cd .. command and try running the command ng new ngadmin it will work.

    0 讨论(0)
  • 2021-01-19 03:02

    You must have used local "npm install @angular/cli" command to install angular locally in your project.

    Uninstall local angular using "npm uninstall @angular/cli" install angular globally using "npm install -g @angular/cli"

    and then try "ng new ngadmin"

    Because "ng new projectName" will automatically install angular/cli locally as a dev-dependency

    0 讨论(0)
  • 2021-01-19 03:05

    Delete the file package.json in current directory where you are trying to create. Then try to install again.

    0 讨论(0)
  • 2021-01-19 03:08

    there is a file package.json

    Simply remove it and then Create project. it will work for sure

    0 讨论(0)
提交回复
热议问题