I managed to successfully run ‘npm install -g angular-cli’, yet I’m facing a new issue. When I try to create a new project with the command ‘ng new ang2pro’, I receive an error stating: ‘You cannot use the new command inside an angular-cli project.’ Here’s the output that appears in my command prompt:
C:\Users\armyTik\Desktop\angular2_projects\1>ng new pro-name
(node:6512) fs: Re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a newer version.
You cannot use the new command inside an angular-cli project.
Yesterday, everything was functioning well. I’ve attempted reinstalling Node.js, and I’m running the command prompt with administrative rights.
I had this issue too! check if you’re inside an existing project folder while running the ‘ng new’ command. you need to be in a directory outside existing angular projects. try creating the project in another directory and see if it works. sometimes its just an issue with the path.
I’ve encountered a similar problem in the past and found that it can sometimes be caused by issues with the cached data stored by npm. Try clearing the npm cache by running the command npm cache clean --force to remove any irrelevant or corrupted cache files. After that, try running the ‘ng new’ command again in a directory outside of any existing Angular projects. Additionally, ensure your Node.js and npm versions are the latest, as this can prevent compatibility problems.
You might want to try running the ‘ng new’ command using PowerShell instead of the usual command prompt. I had something similar before and switching to PowerShell did the trick. Also, try updating the Angular CLI itself with npm update -g @angular/cli, sometimes there’s a version conflict.
In my experience, this kind of problem could also arise if there’s an issue with your PATH environment variable. Sometimes, old versions of libraries or node modules can cause conflicts. You can examine your global npm modules directory to ensure there are no remnants or outdated packages causing interference. Another approach is to uninstall the Angular CLI globally and then install it anew after ensuring your PATH points to the right directories. Also, be sure to check your project’s root folder for any hidden files or configurations left over from previous setups.