1

I've installed nodenv to manage versions of node and npm in my pc. Because when I try install packages like , angular-cli, webpack , typescript, angular2 and another, I get errors

FIRST QUESTION: Can an version node or npm produce error when i install a package?

Some packages tells things like: "The generated project has dependencies that require Node 4.x.x and NPM 3.x.x."

but they don't mention the exact version. by example Can a version of node 4.1.5 produce errors and not the version 4.0.5 ?

SECOND QUESTION: I don't like these packages need be installed like global (-g) and the problems i see sometimes there are conflicts between global packages installed. Example error:

npm WARN EPEERINVALID [email protected] requires a peer of [email protected] || 2.x.x but none was installed. PhantomJS not found on PATH Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip 

but what about if two global packages use same global package, but some of they use a different version for every package?

5
  • "by example Can a version of node 4.1.5 produce errors and not the version 4.0.5 ?" --- who knows. Commented Aug 31, 2016 at 1:34
  • Please show the npm install command you issued which gave that error Commented Aug 31, 2016 at 1:48
  • by example this simply: $npm install -g [email protected] , but anyway i'd like to learn the concept inside node and npm versions , and if they can produce errors Commented Aug 31, 2016 at 1:54
  • I too got errors trying to install that package ... I will dig into this a bit ... suggestion is to avoid such a pointed release and upgrade your own project to use latest version of packages such as angular-cli ... alas life is not that easy at times Commented Aug 31, 2016 at 5:20
  • thanks; i think i must to wait a lot of months angular-cli have good and stable code, i was using the webpack version of angular-cli, another version without @ don't use angular2 rc5, same another alternative like yeoman too, maybe i must to wait 2017, because all those packages are very unstable. so it's better to do things manually for a real project today Commented Aug 31, 2016 at 9:50

1 Answer 1

1

Its up to npm package owners to define in their package.json all the upstream dependencies with a set of working versions which play well together ... challenge is as a package owner to make your package.json loose as possible regarding upstream dependencies to enable pulling in newer releases of these dependent packages yet tight enough that your published package still works

Often this is not the case which can lead to version mismatch invoked errors ... if possible always use most recent package releases this goes for nodejs itself as well

When package.json mentions versions such as 3.x.x it means it should work with any value of x.x so just chose the highest number to fit the pattern

Where possible avoid doing a global install unless it is for command line executables ... this is especially true for packages which your code pulls in as opposed to an executable centric package

UPDATE I am now able to successfully install this

npm install -g angular-cli 

using the latest release of node

node --version v6.5.0 

so I suggest you upgrade your own project code and node version to avoid that pinned release which fails and work with the most current releases

Sign up to request clarification or add additional context in comments.

2 Comments

but why a lot of user with the same package.json and same range version >=X.X.X , or ^X.0.0 report problems on github. There are plenty of issues report like problems where the developper work ok using same version source and package , but people who installed have got the error? I m having a lot of problems with packages for javascript with a lot of dependencies and beta versions. it's a crazy world
anyway i don't know why developers publish npm packages what does not work minimally, it's not about bugs, simple they does not start , they made mistakes, they dont do a good package.json with exact versions dependencies , like: github.com/valor-software/ng2-bootstrap

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.