Skip to content
This repository has been archived by the owner. It is now read-only.

Many unmet peer dependencies #1205

Closed
newz2000 opened this issue Nov 11, 2015 · 21 comments
Closed

Many unmet peer dependencies #1205

newz2000 opened this issue Nov 11, 2015 · 21 comments

Comments

@newz2000
Copy link

newz2000 commented Nov 11, 2015

Hello, I have not used Yeoman in a while and the generator-angular is such a popular and well documented project I decided to use it to give Yeoman a try again. My computer is running Mac OS 10.10.5, using node v5.0.0 and npm 3.3.9. I did not succeed, instead I bumped into four issues that ultimately prevented me from creating and using a project with this generator.

Here are the problems outlined in this issue:

  1. I have to manually install extra global peer dependencies
  2. I have to manually install already installed global peer dependencies
  3. Yeoman doctor says that everything is all right even if it's not
  4. The generator doesn't install all of the local peer dependencies (or there are additional global dependencies that are not documented)

Below is an outline of the problem, I'll keep my computer as-is for now so that I can answer any questions or help with additional details.

I started out the old way of globally installing generator-angular and saw the unmet peer dependency errors (my first problem). I saw then in the docs that I needed to globally install generator-angular as well as the karma dependency, so I did that.

This told me that I had another unmet peer dependency, for yo (second problem), even though yo was already installed:

matt$ npm install -g generator-karma generator-angular
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
/usr/local/lib
├─┬ generator-angular@0.14.0 
...
└── UNMET PEER DEPENDENCY yo@>=1.0.0

npm WARN EPEERINVALID generator-karma@1.0.0 requires a peer of yo@>=1.0.0 but none was installed.

matt$ npm ls -g --depth=0
/usr/local/lib
... 
└── yo@1.5.0

That is pretty silly, but I played along and reran the installation with all three dependencies on the same line. It appeared to work:

matt$ npm install -g yo generator-karma generator-angular
... 
Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version

Everything looks all right!

Installation apparently succeeded (a lie - third problem) so I proceeded to use the newly installed generator. The unmet peer dependency errors came back and I cannot build the project without errors (fourth problem):

yo-angular-demo matt$ yo angular
... 
├── UNMET PEER DEPENDENCY jasmine-core@*
├── UNMET PEER DEPENDENCY karma@^0.13.0 || >= 0.14.0-rc.0
├── karma-jasmine@0.3.6 
├─┬ karma-phantomjs-launcher@0.2.1 
│ └── lodash@3.10.1 
└── UNMET PEER DEPENDENCY phantomjs@>=1.9

npm WARN EPEERINVALID karma-jasmine@0.3.6 requires a peer of jasmine-core@* but none was installed.
npm WARN EPEERINVALID karma-phantomjs-launcher@0.2.1 requires a peer of karma@>=0.9 but none was installed.
npm WARN EPEERINVALID karma-phantomjs-launcher@0.2.1 requires a peer of phantomjs@>=1.9 but none was installed.
npm WARN EPEERINVALID grunt-karma@0.12.1 requires a peer of karma@^0.13.0 || >= 0.14.0-rc.0 but none was installed.

yo-angular-demo matt$ grunt
...
Running "connect:test" (connect) task
Started connect web server on http://localhost:9001
Loading "grunt-karma.js" tasks...ERROR
>> Error: Cannot find module 'karma'
Warning: Task "karma" failed. Use --force to continue.

Aborted due to warnings.

At this point I'm starting to wonder what the benefit of using Yeoman and generator-angular is. At the least, if all of these dependencies need to be installed during the initial installation they should be documented and/or the Yeoman doctor shouldn't tell me that "Everything looks all right!"

But really, I don't want super long installation commands. I use a package manager specifically so I don't have to worry about dependencies.

Please let me know what additional info I can provide to help.

@freeseus
Copy link

freeseus commented Nov 11, 2015

I am not the only one!! I have the EXACT same series of issues above and I REALLY need to know how to fix this.

I did a clean install of Node 5.2.2, git, and heroku toolbelt and then:
npm install -g yo grunt bower gulp generator-angular generator-webapp

Installs fine except can't install sibling dependency of karma (uhhh why not????)

Make a new folder called "test"
yo angular

installs okay until it gets to wiredep is not in your gulpfile and then it won't complete

gulp serve works but gulp will fail

Please help. I'm not sure if nodejs is at fault of yeoman or both or what but what the heck?????

@bostrom
Copy link

bostrom commented Nov 11, 2015

I had the same problem. Try installing the missing dependencies manually after having run yo angular. In my case:

npm install karma jasmine-core phantomjs --save-dev

Then try running npm install again and there should be no output if everything is ok.

@bostrom
Copy link

bostrom commented Nov 13, 2015

What I wonder is if there's a reason for these being left out? Are they supposed to be installed globally, or would it be ok to add them to the generated package.json?

Karma states that

The recommended approach is to install Karma (and all the plugins your project needs) locally in the project's directory.

Jasmine says

You can install Jasmine using npm, locally in your project and globally to use the CLI tool.

PhantomJS instructs

npm install phantomjs

At least there doesn't seem to be any problems in installing them all locally and it worked fine for me.

@eddiemonge
Copy link
Member

eddiemonge commented Nov 13, 2015

The problem isn't Yeoman or this generator. npm3 changed how peerDependencies are handled and no longer automatically installs them. This means you have to do it yourself. We do need better documentation around this. We are still exploring ways of handling this.

@newz2000
Copy link
Author

newz2000 commented Nov 13, 2015

Maybe, but I've gone on to try several other generators and have no problems using them. It is not my place to tell you what to do, but I can say that the project as it stands now causes a lot of friction for new users. There may be a better solution than just documenting the new status quo. For example, check out generator-jhipster and generator-react-fullstack.

@eddiemonge
Copy link
Member

eddiemonge commented Nov 14, 2015

I agree completely. This needs an overhaul and hopefully I can get to it soon (been a couple of years)

@ghost
Copy link

ghost commented Nov 23, 2015

i have my grunt-karma version 0.12.1 but i want grunt-karma version 0.13 - 0.14 as while npm install i m getting "UNMET PEER DEPENDENCY karma@^0.13.0 || >= 0.14.0-rc.0" error . when i run npm install karma@0.13.1 ,i get error /warning WARN engine karma@0.13.1: wanted: {"node":">=0.10 <=0.12 || >=1 <=2"} (current:{"node":"4.2.1","npm":"3.5.0"}) nd nothing happens,can anybody help me out :( i cannot change my node version

@yuanzfy
Copy link

yuanzfy commented Nov 30, 2015

npm install --save-dev karma
this command will install karma and add it to the package.json

@ghost
Copy link

ghost commented Dec 6, 2015

Thank u,it saved me ...:)

@rvmiller
Copy link

rvmiller commented Dec 16, 2015

Respectfully, I've had a tough time getting this toolchain working. Obviously having to manually install dependencies for a package manager isn't ideal, but I fully sympathize/understand that reliance on 3rd party packages makes for some churn.

The main reason I'm posting here is to encourage an update to the Yeoman tutorial, because it's going to dissuade a lot of new users (as it did me).

http://yeoman.io/codelab/index.html

@eddiemonge
Copy link
Member

eddiemonge commented Dec 16, 2015

@rvmiller Yeah thats on our issue list for the site. yeoman/yeoman.io#562 PRs are welcome

@georaldc
Copy link

georaldc commented Dec 28, 2015

One thing I have trouble understanding is why we need to include the dependencies (npm install -g yo generator-karma generator-angular for example), even if you have already installed them globally prior to installing a package (generator-angular in this case)? Or am I understanding this wrong?

@47ronin
Copy link

47ronin commented Jan 21, 2016

@georaldc yeah THIS. What's the point of having a package manager and scaffolding setup if they don't complete the installation of dependencies (and they ignore the presence of globally-present dependencies)? #1205 (comment)

@eddiemonge
Copy link
Member

eddiemonge commented Jan 21, 2016

Dependencies do get installed. peerDependencies don't because npm changes the way it handles them.

@georaldc
Copy link

georaldc commented Jan 21, 2016

Is yo, when globally installed, not seen as an installed peer dependency in this case for say generator-karma, unless you specifically include it again in your npm install command?

@eddiemonge
Copy link
Member

eddiemonge commented Jan 21, 2016

It should be seen. If its not, its a bug in npm

@georaldc
Copy link

georaldc commented Jan 21, 2016

@eddiemonge That's the problem @newz2000 has as indicated by his post

This told me that I had another unmet peer dependency, for yo (second problem), eventhough yo was already installed

and it's something I also noticed the last time I tried using generator-angular. The only way to get the error to go away is to redundantly include yo again when installing the generator, as well as a bunch of other things seen as a dependency

npm install -g yo generator-karma generator-angular

@eddiemonge
Copy link
Member

eddiemonge commented Jan 22, 2016

Again, its a bug in npm then

@newz2000
Copy link
Author

newz2000 commented Jan 22, 2016

I've moved on, but I do think it's interesting to note that I've not had problems with any other npm module, nor with any other generators. It may be wise for the devs to consider if there's a different way to use npm to accomplish the desired results.

@overmedia
Copy link

overmedia commented Feb 4, 2016

So, package.json keep traying to install all dependencies BUT installation keeps failing and we have to install all dependencies included in "devDependencies": {...} manually?

@Tafhim
Copy link

Tafhim commented May 1, 2016

How do you resolve dependencies between global and local packages?

For example: karma needs to be global but the rest of the packages (jasmine-core, phantomjs-prebuilt etc) need to be installed as --save-dev. In such a scenario how can I resolve the dependencies manually?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants