x)- [x] bug report -> please search issues before submitting
- [ ] feature request
@angular/cli: 1.0.0
node: 7.7.3
os: linux x64
sudo yarn global upgrade @angular/cli
sudo yarn global remove @angular/cli
sudo yarn global add @angular/cli
Run any ng command
Unable to find "@angular/cli" in devDependencies.
Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest"
ng command runs without issues.
I am not sure this is related, but all new Angular apps I create using the CLI appear in the Home directory instead of the directory the command was run in.
It appears this was caused by having a node_modules folder and package.json file in the home directory, probably caused by doing an incorrect npm install command in the past.
I'm going to keep this open actually, we shouldn't check that root package.json really.
I have this same issue, how can I fix this?
I got the same issue, this was after updating my angular cli on my project folder.
I got it, in my case I had to delete package.json which I create earlier in application folder.
I have the same issue. Please tell me whats is happening. I already run the commands suggested without success and I don't think than need to delete package.json.
This happens to me only if a package.json already exists in same directory where running "ng new app-name", in my case the package.json I use for my server side node app.
Hi,
I ran into the same problem when I tried to create a component in Angular2 quickstart project. This is what solved my problem.
First make sure you install angular cli as;
npm install -g @angular/cli
then cd to where you want to put your project.
ng new your_project_name
cd your_project_name
ng serve
To add a component, cd to your_project_name and run;
comp@debian:~/Desktop/your_project_name$ng generate component mycompo
This will create your componet under mycompo folder in src/app/mycompo
I changed the following line in _package.json_ from
"angular-cli": "1.0.0-beta.21",
to
"@angular/cli": "1.0.4",
and it worked. For my case that was the solution.
I had the same issue following steps helped me to resolve it,
Update package json
from
"angular-cli": "anything"
to
"@angular/cli": "1.0.4"
Deleted node_modules and installed node modules again with
npm install
Change angular-cli.json for
from
"environments": {
"source": "environments/environment.ts"
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
to
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
Closing as this doesn't seem to be an issue anymore.
As otonielguajardo mentioned, this happens when package.json exists in the directory where 'ng new-app-name' is run, as when creating a front-end for a server-side node app. To resolve this, I ran the command in a separate directory, then moved the created folder under my original app folder.
I have a monorepo with following structure:
root
|-packages
| |-angular-package1\
| |-angular-package2\
| ...
|-lerna.json
|-package.json
I am facing the following problem while ng new myapp --routing --directory packages/myapp. If I don't include "@angular/cli": "^1.7.3" in devDependencies it complaints about Unable to find "@angular/cli" in devDependencies., and when I do, it tells me You cannot use the new command inside an Angular CLI project.. 馃檨
I using mac.. My node -v 8.11.1 .. I have removed @angular/cli...
Then i have given sudo npm install -g @angular/[email protected] is it Angular4?
After that it's showing error .. If give sudo npm install -g @angular/cli it is taking latest version i.e. Angular CLI: 6.0.7
I need to install Angular4 on Mac how can i do ?
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
It appears this was caused by having a
node_modulesfolder andpackage.jsonfile in the home directory, probably caused by doing an incorrectnpm installcommand in the past.