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

[BUG] version specifier doesn't work with scoped packages in npm init #5175

Closed
2 tasks done
alan-agius4 opened this issue Jul 15, 2022 · 8 comments · Fixed by #5206
Closed
2 tasks done

[BUG] version specifier doesn't work with scoped packages in npm init #5175

alan-agius4 opened this issue Jul 15, 2022 · 8 comments · Fixed by #5206
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@alan-agius4
Copy link

alan-agius4 commented Jul 15, 2022

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When using npm init the version specifier doesn't work when the package is scoped.

Expected Behavior

The version specifier is used and the command doesn't error.

Steps To Reproduce

$ npm create @angular@next
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "@angular" of package "@angular@next/create": name can only contain URL-friendly characters.

Environment

  • npm: 8.11.0
  • Node.js: 16.15.1
  • OS Name: Linux 5.17 Debian GNU/Linux rodete 12 (rodete)
  • System Model Name: cloud
@alan-agius4 alan-agius4 added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jul 15, 2022
@alan-agius4 alan-agius4 changed the title [BUG] version specifier doesn't work with scoped packages in npm init [BUG] version specifier doesn't work with scoped packages in npm init Jul 15, 2022
@ljharb
Copy link
Collaborator

ljharb commented Jul 15, 2022

When it's scoped, you have to use the full package name - @angular/create

@alan-agius4
Copy link
Author

That doesn't works either

npm init @angular/create@next
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@angular%2fcreate-create - Not found
npm ERR! 404 
npm ERR! 404  '@angular/create-create@next' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

@marssaljr
Copy link

@alan-agius4 Have you tried this?

npm install -g @angular/cli
ng new [PROJECT NAME]

@alan-agius4
Copy link
Author

Hi @marssaljr, I am well aware of that command, as I am from the Angular team. The bug I am reporting is caused by NPM init command is incorrectly handling version specifiers when using scoped packages.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jul 18, 2022
NPM doesn't correctly handle version specifier for scoped packages when using the `init` command

See: npm/cli#5175
clydin pushed a commit to angular/angular-cli that referenced this issue Jul 18, 2022
NPM doesn't correctly handle version specifier for scoped packages when using the `init` command

See: npm/cli#5175
(cherry picked from commit 467ba5a)
clydin pushed a commit to angular/angular-cli that referenced this issue Jul 18, 2022
NPM doesn't correctly handle version specifier for scoped packages when using the `init` command

See: npm/cli#5175
@wraithgar wraithgar added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Jul 21, 2022
@wraithgar wraithgar self-assigned this Jul 21, 2022
@wraithgar
Copy link
Member

Sorry about that @alan-agius4. Should be fixed by #5206

@alan-agius4
Copy link
Author

Thanks @wraithgar

@wraithgar
Copy link
Member

@alan-agius4 this is in npm@8.15.1

@alan-agius4
Copy link
Author

Great thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants