Skip to content

ng new fails with latest version of @angular/cli and npm #20719

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
1 of 15 tasks
Badisi opened this issue May 7, 2021 · 9 comments
Closed
1 of 15 tasks

ng new fails with latest version of @angular/cli and npm #20719

Badisi opened this issue May 7, 2021 · 9 comments

Comments

@Badisi
Copy link

Badisi commented May 7, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes

Description

When using the latest version of @angular/cli and npm the command ng new fails during dependencies installation.
(but it's working fine with yarn)

[email protected] requires a peer jasmine-core@">=3.7.1" but [email protected] is used in the root project.

🔬 Minimal Reproduction

Run the following command:

ng new app-test --package-manager=npm --defaults

🔥 Exception or Error

> ng new app-test --package-manager=npm --defaults
CREATE app-test/README.md (1017 bytes)
CREATE app-test/.editorconfig (274 bytes)
CREATE app-test/.gitignore (631 bytes)
CREATE app-test/angular.json (3551 bytes)
CREATE app-test/package.json (1209 bytes)
CREATE app-test/tsconfig.json (538 bytes)
CREATE app-test/tslint.json (3185 bytes)
CREATE app-test/.browserslistrc (703 bytes)
CREATE app-test/karma.conf.js (1425 bytes)
CREATE app-test/tsconfig.app.json (287 bytes)
CREATE app-test/tsconfig.spec.json (333 bytes)
CREATE app-test/src/favicon.ico (948 bytes)
CREATE app-test/src/index.html (293 bytes)
CREATE app-test/src/main.ts (372 bytes)
CREATE app-test/src/polyfills.ts (2830 bytes)
CREATE app-test/src/styles.css (80 bytes)
CREATE app-test/src/test.ts (753 bytes)
CREATE app-test/src/assets/.gitkeep (0 bytes)
CREATE app-test/src/environments/environment.prod.ts (51 bytes)
CREATE app-test/src/environments/environment.ts (662 bytes)
CREATE app-test/src/app/app.module.ts (314 bytes)
CREATE app-test/src/app/app.component.css (0 bytes)
CREATE app-test/src/app/app.component.html (24923 bytes)
CREATE app-test/src/app/app.component.spec.ts (946 bytes)
CREATE app-test/src/app/app.component.ts (212 bytes)
CREATE app-test/e2e/protractor.conf.js (904 bytes)
CREATE app-test/e2e/tsconfig.json (274 bytes)
CREATE app-test/e2e/src/app.e2e-spec.ts (659 bytes)
CREATE app-test/e2e/src/app.po.ts (274 bytes)
⠏ Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/jasmine-core
npm ERR!   dev jasmine-core@"~3.6.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.7.1" from [email protected]
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR!   dev karma-jasmine-html-reporter@"^1.5.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/user/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2021-05-07T17_40_35_034Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.

🌍 Your Environment

  • Angular CLI: 11.2.12
  • Node: 14.15.1
  • Npm: 7.12.0
  • OS: darwin x64
clydin added a commit to clydin/angular-cli that referenced this issue May 7, 2021
…s in new projects

Synchronizes the version pinning strategy with the other karma and jasmine project dependencies.
Allows project's created with npm 7+ to successfully install. `[email protected]` requires dependency versions not present in a new 11.2.x project.

Fixes angular#20719
@ngbot ngbot bot modified the milestone: Backlog May 9, 2021
@mbwgh
Copy link

mbwgh commented May 9, 2021

Until this is fixed, how can I create a new project? Is there a way to pass --legacy-peer-deps to npm?
ng new --minimal still works, which is better than nothing I guess.

@alan-agius4
Copy link
Collaborator

Until this is fixed, how can I create a new project? Is there a way to pass --legacy-peer-deps to npm?
ng new --minimal still works, which is better than nothing I guess.

You can you —skip-install to skip invoking npm during the project creation. You can then run npm install manually after the project has been created

@crabouif
Copy link

crabouif commented May 9, 2021

Until this is fixed, how can I create a new project? Is there a way to pass --legacy-peer-deps to npm?
ng new --minimal still works, which is better than nothing I guess.

You can you —skip-install to skip invoking npm during the project creation. You can then run npm install manually after the project has been created

Not really working, but npm install --force works.

@alan-agius4 alan-agius4 self-assigned this May 10, 2021
@NguyenHiep
Copy link

I have an issue similar when install and create a new project

filipesilva pushed a commit that referenced this issue May 10, 2021
…s in new projects

Synchronizes the version pinning strategy with the other karma and jasmine project dependencies.
Allows project's created with npm 7+ to successfully install. `[email protected]` requires dependency versions not present in a new 11.2.x project.

Fixes #20719
@oxenprogrammer
Copy link

Downgrade npm from 7 to 6 using npm install -g npm@6

@alan-agius4 alan-agius4 removed their assignment May 10, 2021
@alan-agius4
Copy link
Collaborator

Closed via #20720

@S1nPur1ty
Copy link

Wait, why is @alan-agius4 closing this issue? You guys need to check if there is a workaround instead of "IGNORING" this issue.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 2, 2021

Wait, why is @alan-agius4 closing this issue? You guys need to check if there is a workaround instead of "IGNORING" this issue.

We didn’t ignore this, we closed it because it was solved via PR #20720

@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 Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants