Skip to content

CLI error when found 'package.json' has no 'devDependencies' entry #5070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spongessuck opened this issue Feb 27, 2017 · 4 comments · Fixed by #5074
Closed

CLI error when found 'package.json' has no 'devDependencies' entry #5070

spongessuck opened this issue Feb 27, 2017 · 4 comments · Fixed by #5074

Comments

@spongessuck
Copy link

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OS X El Capitan

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

1.0.0-rc.0

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Run any cli command in a directory that contains a package.json or a subdirectory whose parent contains a package.json.

The log given by the failure.

Normally this include a stack trace and some more information.

/Users/Greg/.nvm/versions/node/v6.10.0/lib/node_modules/@angular/cli/bin/ng:95
const hasOldDevDep = !!packageJsonProject.devDependencies['angular-cli'];
^

TypeError: Cannot read property 'angular-cli' of undefined
at Object. (/Users/Greg/.nvm/versions/node/v6.10.0/lib/node_modules/@angular/cli/bin/ng:95:60)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

Mention any other details that might be useful.

The package.json file in question was in my HOME folder (I think Yarn put it there- #4762 pointed me in the right direction) and it only had a dependencies section. Once I added a devDependencies section the CLI worked properly.


Thanks! We'll be in touch soon.

@anantgoldie
Copy link

@hansl I can see this issue has been closed. But is the code released ? I am trying to install it but still the same error.

sudo npm install -g @angular/cli@latest

@sumitarora
Copy link
Contributor

asnowwolf pushed a commit to asnowwolf/angular-cli that referenced this issue Apr 12, 2017
@rageshvr
Copy link

Why is it showing a warning even though I have CLI installed globally.

Unable to find "@angular/cli" in devDependencies.

Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest"

@angular/cli: 1.1.3
node: 7.2.1
os: win32 x64

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants