Skip to content
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

Init error (npm 2 dependency) #2179

Closed
ValeryVS opened this issue Sep 16, 2016 · 16 comments
Closed

Init error (npm 2 dependency) #2179

ValeryVS opened this issue Sep 16, 2016 · 16 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@ValeryVS
Copy link
Contributor

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Ubuntu 14.04
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.14
node: 6.6.0
os: linux x6
  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.

ng init

  1. The log given by the failure. Normally this include a stack trace and some
    more information.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
installing ng2
  identical .editorconfig
  create README.md
  create src/app/app.component.css
  create src/app/app.component.html
  create src/app/app.component.spec.ts
  create src/app/app.component.ts
  create src/app/app.module.ts
  create src/app/index.ts
  create src/app/shared/index.ts
  create src/assets/.gitkeep
  create src/assets/.npmignore
  create src/environments/environment.prod.ts
  create src/environments/environment.ts
  create src/favicon.ico
  create src/index.html
  create src/main.ts
  create src/polyfills.ts
  create src/styles.css
  create src/test.ts
  create src/tsconfig.json
  create src/typings.d.ts
  create angular-cli.json
  create e2e/app.e2e-spec.ts
  create e2e/app.po.ts
  create e2e/tsconfig.json
  identical .gitignore
  create karma.conf.js
  create package.json
  create protractor.conf.js
  create tslint.json
Installing packages for tooling via npm.
npm WARN prefer global [email protected] should be installed with -g
npm WARN prefer global [email protected] should be installed with -g
npm WARN prefer global [email protected] should be installed with -g
npm WARN unmet dependency /home/valeryvs/Git/angular-cli-test-4/node_modules/angular-cli requires protractor@'^3.3.0' but will load
npm WARN unmet dependency /home/valeryvs/Git/angular-cli-test-4/node_modules/protractor,
npm WARN unmet dependency which is version 4.0.5
npm WARN unmet dependency /home/valeryvs/Git/angular-cli-test-4/node_modules/angular-cli requires tslint@'^3.15.1' but will load
npm WARN unmet dependency /home/valeryvs/Git/angular-cli-test-4/node_modules/tslint,
npm WARN unmet dependency which is version 3.13.0
npm ERR! Linux 4.4.0-36-generic
npm ERR! argv "/usr/bin/nodejs" "/home/valeryvs/Git/angular-cli-test-4/node_modules/.bin/npm" "install"
npm ERR! node v6.6.0
npm ERR! npm  v2.14.21
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants webpack@*
npm ERR! peerinvalid Peer [email protected] wants webpack@^1.1.0 || ^2 || ^2.1.0-beta
npm ERR! peerinvalid Peer [email protected] wants webpack@^1.12.6 || ^2.1.0-beta
npm ERR! peerinvalid Peer [email protected] wants [email protected] || 2.x.x
npm ERR! peerinvalid Peer [email protected] wants webpack@^2.1.0-beta

npm ERR! Please include the following file with any support request:
npm ERR!     /home/valeryvs/Git/angular-cli-test-4/npm-debug.log

Package install failed, see above.

  1. Mention any other details that might be useful.

Package
[email protected]
depends on
[email protected]

"Installing packages for tooling via npm." use this npm@2

But npm 2 can not install new webpack.
Hashnode/mern-cli#12
kentcdodds/es6-todomvc#4

@celliott181
Copy link
Contributor

I'm almost certain you've misread this error. NPM 2 is not required by any of the dependencies, and it looks more like an issue with webpack. Have you tried npm cache clean lately? How about checking for global installs of Webpack from previous projects?

This looks like a dirty environment more than anything.

@ValeryVS
Copy link
Contributor Author

See theese lines in log

...
Installing packages for tooling via npm.
...
npm ERR! node v6.6.0
npm ERR! npm  v2.14.21
...

And there is [email protected]'s package.json
https://github.com/ember-cli/ember-cli/blob/v2.5.0/package.json

@bonnici
Copy link

bonnici commented Sep 16, 2016

That's saying that you have npm v2.14.21 installed. You'll need to update it as angular-cli requires 3.x.x.

@ValeryVS
Copy link
Contributor Author

This is not my global npm, this is local npm from ember-cli dependency.

@ValeryVS
Copy link
Contributor Author

BTW I'am able to install packages, using my global npm npm install after ng init fail.

@rcomblen
Copy link

Similar issue, works fine the first time I do npm install, and fails with this error when I run it a second time. Using 1.0.0-beta.14 on Docker container (node:6).

@rcomblen
Copy link

Ok, found the solution on my side: I had put node_modules/.bin in my PATH, so it was using the npm from there, and that was v2.14.21.

@filipesilva
Copy link
Contributor

This is very, very odd. I thought I fixed it in #2086 by replacing tasks/npm-install.ts, but somehow stuff is still getting installed with npm2.

@rcomblen's scenario would account for it, yes. Have you checked his comment @ValeryVS?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Sep 22, 2016
@ValeryVS
Copy link
Contributor Author

@filipesilva
Right. I use local package, same way

alias npm-exec='PATH=$(npm bin):$PATH'
npm-exec ng init

and npm versions are...

$ npm -v
3.10.3
$ npm-exec npm -v
2.14.21

npm-exec ng init use npm 2 and failed
but ./node_modules/angular-cli/bin/ng init works well

@ValeryVS
Copy link
Contributor Author

We, probably, can
get process.env.PATH
exclude path that match /node_modules\/\.bin/ and run child_process.exec with modified PATH

@ValeryVS
Copy link
Contributor Author

I made a PR #2301

@nathanBrenner
Copy link

Experiencing the same issue. Looks like peer dependancies need to be updated. Works fine on my local machine

angular-cli: 1.0.0-beta.15
node: 6.6.0
os: darwin x64
npm: 3.10.3

but get's this error on CircleCI, which is running Ubuntu 14.04 (Trusty)

@filipesilva
Copy link
Contributor

@ValeryVS I just tested myself, and during ng init the npm used is the system-wide one, not the local one. I tested by editing packages/angular-cli/tasks/npm-install.ts to exec and output npm -v instead of npm install.

The origin of your problem is using your npm-exec alias, and I'm sorry but I can't accept a PR to special-case that use. You're adding the local npm bin yourself and it might include a npm binary there, coming from ember-cli or any other package.

@nathan-j-brenner check $PATH in CircleCI. I vaguely remember some CI's added ./node_modules/.bin (note that it's relative) to the $PATH.

@asacamano
Copy link

Another way this error condition can present itself is if you install npm3 as recommended on the npm3 package page [https://www.npmjs.com/package/npm3].

In that case you end up with npm -> npm v2, and npm3 -> npm v3. I had to manually switch the symlinks that npm3 installed - to npm -> npm v3 and npm2 -> npm v2 - and then angular cli started working for me.

@filipesilva
Copy link
Contributor

I should mention that there is also a --skip-npm flag in ng init and ng new that will not do any npm operations. That way you can do them manually afterwards.

@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants