可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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:
fs: re-evaluating native module sources is not supported. If you are
using the graceful-fs module, please update it to a more recent
version.
You cannot use the new command inside an angular-cli project.
I am not sure what the problem is as this cli was working fine for me a few days ago.
回答1:
Check in your username folder, if there is package.json
and node_module
exist. If they are there then delete them.
Notice: you may have created an angular project in your home/username
directory. If you delete them it will work.
回答2:
If using Linux, go to home and delete package.json
.
回答3:
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.
回答4:
I had this problem as well. Here is how I fixed it:
- Go to package.json
- Under "Dependencies", find "angular-cli": "^1.0.0-beta.18"
- Delete this line ("angular-cli": "^1.0.0-beta.18")
- Save file
Hope that helps!
回答5:
Seems like i fixed my problem. I have no idea what happened but i noticed system32 was not in my PATH so i added that and uninstalled and reinstalled the angular-cli package. everything works like a charm now
回答6:
I had the same issue, the thing was I was not closely following along the tutorial I was watching and I tried using the same directory, I used cd .. to move up in the file structure and it worked like a charm, hope this helps!
回答7:
i had the same problem today, I started a fresh project and did
npm install -save @angular/cli
and received the error.
I just renamed the package.json to .json2 temporarily and it worked.
回答8:
Delete the file package.json
in current directory where you are trying to create. Then try to install again.
回答9:
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
回答10:
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
回答11:
there is a file package.json
Simply remove it and then Create project.
it will work for sure