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

Invalid package name "@spartan-ng/brain/collapsible" of package "@spartan-ng/brain/[email protected]": name can only contain URL-friendly characters #545

Closed
1 of 2 tasks
bidonazzo opened this issue Dec 26, 2024 · 7 comments · Fixed by #548
Assignees
Labels
bug Something isn't working

Comments

@bidonazzo
Copy link

Please provide the environment you discovered this bug in.

Node version: v20.18.1
NPM version: 10.8.2
Angular version: 19.0.6

Which area/package is the issue in?

collapsible

Description

I created a new app with ng new, to simulate this error I don't understand. I followed all the steps of spartan/ui and also of the tailwind configuration.

When I get to the final part of adding the primitives, with the ng g @spartan-ng/cli:ui command, a list pops up where I choose the primitive to install.

  • If I choose a simple primitive such as a button, it is installed without any problems in libs/ui
  • If I try to install a collapsible or accordion I get the following error:
npm error code EINVALIDPACKAGENAME
npm error Invalid package name “@spartan-ng/brain/collapsible” of package “@spartan-ng/brain/[email protected]”: name can only contain URL-friendly characters.
npm error A complete log of this run can be found in: /home/bidonazzo/.npm/_logs/2024-12-26T19_38_48_400Z-debug-0.log
Command failed: npm install

Please provide the exception or error you saw

0 verbose cli /usr/bin/node /usr/bin/npm
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:/usr/lib/node_modules/npm/npmrc
4 silly config load:file:/home/bidonazzo/spartan-test/.npmrc
5 silly config load:file:/home/bidonazzo/.npmrc
6 silly config load:file:/usr/etc/npmrc
7 verbose title npm install
8 verbose argv "install"
9 verbose logfile logs-max:10 dir:/home/bidonazzo/.npm/_logs/2024-12-26T19_38_48_400Z-
10 verbose logfile /home/bidonazzo/.npm/_logs/2024-12-26T19_38_48_400Z-debug-0.log
11 silly packumentCache heap:2197815296 maxSize:549453824 maxEntrySize:274726912
12 silly logfile start cleaning logs, removing 1 files
13 silly logfile done cleaning log files
14 silly idealTree buildDeps
15 verbose stack Error: Invalid package name "@spartan-ng/brain/collapsible" of package "@spartan-ng/brain/[email protected]": name can only contain URL-friendly characters.
15 verbose stack     at invalidPackageName (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:111:15)
15 verbose stack     at Result.setName (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:158:11)
15 verbose stack     at new Result (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:147:10)
15 verbose stack     at Function.resolve (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:59:15)
15 verbose stack     at #nodeFromEdge (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1036:22)
15 verbose stack     at #buildDepStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:901:35)
15 verbose stack     at #buildDeps (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:754:30)
15 verbose stack     at Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:28)
15 verbose stack     at async Promise.all (index 1)
15 verbose stack     at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5)
16 error code EINVALIDPACKAGENAME
17 error Invalid package name "@spartan-ng/brain/collapsible" of package "@spartan-ng/brain/[email protected]": name can only contain URL-friendly characters.
18 silly unfinished npm timer reify 1735241928563
19 silly unfinished npm timer reify:loadTrees 1735241928570
20 silly unfinished npm timer idealTree:buildDeps 1735241928958
21 silly unfinished npm timer idealTree:#root 1735241928959
22 verbose cwd /home/bidonazzo/spartan-test
23 verbose os Linux 6.5.11-7-pve
24 verbose node v20.18.1
25 verbose npm  v10.8.2
26 verbose exit 1
27 verbose code 1
28 error A complete log of this run can be found in: /home/bidonazzo/.npm/_logs/2024-12-26T19_38_48_400Z-debug-0.log

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@bidonazzo bidonazzo added the bug Something isn't working label Dec 26, 2024
@sickmz
Copy link

sickmz commented Dec 27, 2024

looks similar to #532

@SantiagoBolumburu
Copy link

looks similar to #532

I have the same problem @bidonazzo when trying to set up a new angular project.
Attempted the solution proposed in #532 without success.

@samsonkumawong
Copy link
Contributor

is it because the package not found on npmjs? https://www.npmjs.com/package/@spartan-ng/brain/collapsible

@namdien177
Copy link

image There is an issue with `@spartan-ng/brain/[email protected]` too.

I don't want to be a meanie, but there are too many bugs related to NPM publish. I understand we are doing this the “alpha” way, but can we just have a more stable way to publish and for everyone to install the library confidently?

@namdien177
Copy link

The temporary workaround is to downgrade the @spartan-ng/cli package to 0.0.1-alpha.374

@goetzrobin
Copy link
Collaborator

Sorry for the delayed response. I was away for the holidays but will spend some time on this, this weekend.

We moved to secondary entry points.
You'll have to remove the legacy imports from your package.json and update the imports in your project.

There's also an automatic migration you can run: #532 (comment)

Hope this helps and happy new year!

@goetzrobin goetzrobin self-assigned this Jan 7, 2025
@goetzrobin
Copy link
Collaborator

@bidonazzo this will be fixed by the changes that are part of this PR #524. You can also remove all spartan related dependencies from your package.json besides @spartan-ng/brain and @spartan-ng/ui-core after running the ng g @spartan-ng/cli:ui command for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

6 participants