yeoman / generator-angular

Yeoman generator for AngularJS
http://yeoman.io
5.73k stars 1.44k forks source link

yo angular fails with npm error #527

Closed mbana closed 10 years ago

mbana commented 10 years ago

I cannot get this running. Following http://yeoman.io/gettingstarted.html.

$ node --version
v0.10.22
$ npm --version
1.3.22

No packages at all installed in npm before invoking commands.

Nothing atnpm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer karma-ng-html2js-preprocessor@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-ng-scenario@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer grunt-karma@0.6.2 wants karma@~0.10.0

Log: https://gist.github.com/mbana/8148992.

DaftMonk commented 10 years ago

This is happening in the fullstack generator as well. https://github.com/DaftMonk/generator-angular-fullstack/issues/40. I posted a workaround.

passy commented 10 years ago

You have an old, global karma installation. Run npm uninstall -g karma first and install the angular generator afterwards.

DaftMonk commented 10 years ago

@passy Does the generator work for you? I did exactly what you said and get the same error.

passy commented 10 years ago

@DaftMonk Yes, it does. You can also try to clean your npm cache by running npm cache clean, but as the error says, the main issue here is that you have an incompatible version of karma installed.

DaftMonk commented 10 years ago

Tried clearing my cache and reinstalling again, same error. Heres my installed npm packages.

C:\Users\Tyler\JSworkspace>npm list -g --depth=0.
C:\Users\Tyler\AppData\Roaming\npm
├── bcrypt@0.7.7
├── bower@1.2.8
├── ejs@0.8.4
├── express@3.4.4
├── generator@1.0.1
├── generator-angular@0.7.1
├── generator-angular-fullstack@1.1.1
├── generator-angular-module@1.0.2
├── generator-angularjs-library@1.0.2
├── generator-backbone@0.2.0
├── generator-generator@0.4.1
├── generator-heroku@0.0.6
├── generator-karma@0.6.0
├── generator-meanstack@0.0.6
├── generator-mocha@0.1.1
├── generator-ngmodule@0.0.0
├── generator-webapp@*
├── grunt-cli@0.1.9
├── grunt-init@0.2.1
├── heroku@0.1.2
├── jake@0.7.3
├── jsbin@*
├── karma@0.10.8
├── karma-chrome-launcher@0.1.1
├── karma-coffee-preprocessor@0.1.1
├── karma-firefox-launcher@0.1.2
├── karma-html2js-preprocessor@0.1.0
├── karma-jasmine@0.1.4
├── karma-phantomjs-launcher@0.1.1
├── karma-requirejs@0.2.0
├── karma-script-launcher@0.1.0
├── phantomjs@1.9.1-6
├── requirejs@2.1.9
├── sloc@0.0.4
├── steroids@3.1.11
└── yo@1.0.4
kimifoud commented 10 years ago

I'm getting the same error. Tried with a fresh npm, too.

eddiemonge commented 10 years ago

try:

npm remove -g *karma* yo generator-angular
npm install -g generator-angular
kimifoud commented 10 years ago

Still the same.

$ npm remove -g *karma* yo generator-angular
npm WARN uninstall not installed in /usr/local/lib/node_modules: "karma-e2e.conf.js"
npm WARN uninstall not installed in /usr/local/lib/node_modules: "karma.conf.js"
unbuild yo@1.0.7-pre.2
unbuild generator-angular@0.7.1

$ npm install -g generator-angular
[installed with no errors]

$ yo angular
[?] Would you like to use Sass (with Compass)? Yes
[?] Would you like to include Twitter Bootstrap? Yes
[?] Would you like to use the Sass version of Twitter Bootstrap? Yes
[?] Which modules would you like to include? angular-resource.js, angular-cookies.js, angular-sanitize.js, angular-route.js
[..]
npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer karma-ng-html2js-preprocessor@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-ng-scenario@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer grunt-karma@0.6.2 wants karma@~0.10.0

npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.24/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/kk/workspace/frontend
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/kk/workspace/frontend/npm-debug.log
npm ERR! not ok code 0
eddiemonge commented 10 years ago

seems like you might have a messed up install of npm. maybe try uninstalling all your npm -g things and then reinstall them? maybe even with a npm/node uninstall/install thrown in?

DaftMonk commented 10 years ago

I don't see how uninstalling all our global packages will fix this... This was working fine a couple days ago, now many of us are having this problem. I wonder what changed.

illuminace commented 10 years ago

I've been forcefully wiping all caches (global, local), uninstalling & reinstalling fresh/latest versions of npm for a while now, without any success.

Specifying versions of "grunt-karma" and "karma" in the package-json, as indicated by DaftMonk, temporarily resolves it for me.

nscape commented 10 years ago

I have the exact same issue.

I have an up-to-date version of node and NPM. I have never installed anything to do with karma or yo before this.

I have been doing the following with all global modules uninstalled:

npm cache clean npm install -g yo npm install -g generator-angular yo angular

At which point it fails:

npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer karma-ng-html2js-preprocessor@0.1.0 wants karma@>=0.9 npm ERR! peerinvalid Peer karma-ng-scenario@0.1.0 wants karma@>=0.9 npm ERR! peerinvalid Peer grunt-karma@0.6.2 wants karma@~0.10.0

npm ERR! System Linux 3.5.0-17-generic npm ERR! command "node" "/home/x/local/bin/npm" "install" npm ERR! cwd /home/blah npm ERR! node -v v0.10.24 npm ERR! npm -v 1.3.22 npm ERR! code EPEERINVALID

DaftMonk commented 10 years ago

Seems to be working for me again. I tried doing @eddiemonge suggestion earlier, but didn't check if it worked at the time. I think that was the only thing I changed, but I can't be sure because I was messing with some other things. Can anyone else confirm if that suggestion fixes this error for them?

nscape commented 10 years ago

I just ran yo angular without doing absolutely anything and it worked just now after failing ~10 times over the last 2 days.

DaftMonk commented 10 years ago

@nscape That's really strange. Maybe it just started spontaneously working for me as well. I wonder if a package description got updated.

kimifoud commented 10 years ago

Same here. Works for me now, too. I didn't change anything, so I reckon it was a temporary problem with some of the dependencies?

tfogo commented 10 years ago

Also working for me again after a day of errors. Perhaps there was a problem with the Karma dependencies that got fixed?

Big thanks to @DaftMonk for the workaround yesterday.

eddiemonge commented 10 years ago

If its working for everyone, can we close this?

Siranto commented 9 years ago

It's not working again today

eddiemonge commented 9 years ago

@Siranto please open a new issue as this is an old one and the problem is probably different

dezoxel commented 9 years ago

Removing local project node_modules helped me resolve the issue.