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] npm ls --all throws ELSPROBLEMS with tree created by npm #6856

Closed
2 tasks done
targos opened this issue Oct 2, 2023 · 23 comments
Closed
2 tasks done

[BUG] npm ls --all throws ELSPROBLEMS with tree created by npm #6856

targos opened this issue Oct 2, 2023 · 23 comments
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 9.x work is associated with a specific npm 9 release Release 10.x

Comments

@targos
Copy link
Contributor

targos commented Oct 2, 2023

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

With a dependency tree freshly created with npm install, running npm ls --all throws an error for one of the subdependencies.
The reason is that the tree deduplication made a mistake. The wrong major version of that dependency is installed relative to another subdependency.

Expected Behavior

npm ls --all should not error for a dependency tree optimized by npm itself.

Steps To Reproduce

  1. git clone https://github.com/nodejs/citgm.git
  2. cd citgm
  3. npm install
  4. npm ls --all or npm ls wrap-ansi

The problem is that node_modules/tap/node_modules/cliui wants wrap-ansi@^7.0.0, but npm installed wrap-ansi@6.2.0 in node_modules/tap/node_modules/wrap-ansi.

> npm ls --all    
npm ERR! code ELSPROBLEMS
npm ERR! invalid: wrap-ansi@6.2.0 D:\Git\nodejs\citgm\node_modules\tap\node_modules\wrap-ansi
citgm@9.1.1 D:\Git\nodejs\citgm
...
| +-- jackspeak@1.4.2
| | `-- cliui@7.0.4
| |   +-- string-width@4.2.3 deduped
| |   +-- strip-ansi@6.0.1 deduped
| |   `-- wrap-ansi@6.2.0 deduped invalid: "^7.0.0" from node_modules/tap/node_modules/cliui

See nodejs/citgm#990 for more context.

Environment

  • npm: 10.1.0
  • Node.js: 20.8.0
  • OS Name: Windows
  • System Model Name: Desktop/AMD
  • npm config:
> npm config ls   
; "user" config from C:\Users\Targos\.npmrc

//registry.npmjs.org/:_authToken = (protected)

; "project" config from D:\Git\nodejs\citgm\.npmrc

package-lock = false

; node bin location = C:\Users\Targos\AppData\Local\Volta\tools\image\node\20.8.0\node.exe
; node version = v20.8.0
; npm local prefix = D:\Git\nodejs\citgm
; npm version = 10.1.0
; cwd = D:\Git\nodejs\citgm
; HOME = C:\Users\Targos
; Run `npm config ls -l` to show all defaults.
@targos targos added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Oct 2, 2023
@lukekarrys lukekarrys added Priority 1 high priority issue Release 9.x work is associated with a specific npm 9 release and removed Needs Triage needs review for next steps labels Oct 6, 2023
@khanempire
Copy link

npm install itself is giving issues:-

npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules@jridgewell.trace-mapping.DELETE\node_modules@jridgewell' -> 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules@jridgewell\trace-mapping\node_modules@jridgewell'
npm ERR! [OperationalError: EPERM: operation not permitted, rename 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules@jridgewell.trace-mapping.DELETE\node_modules@jridgewell' -> 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules@jridgewell\trace-mapping\node_modules@jridgewell'] {
npm ERR! cause: [Error: EPERM: operation not permitted, rename 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules@jridgewell.trace-mapping.DELETE\node_modules@jridgewell' -> 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules@jridgewell\trace-mapping\node_modules@jridgewell'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules\@jridgewell\.trace-mapping.DELETE\node_modules\@jridgewell',
npm ERR! dest: 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules\@jridgewell\trace-mapping\node_modules\@jridgewell'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules\@jridgewell\.trace-mapping.DELETE\node_modules\@jridgewell',
npm ERR! dest: 'E:\Front-end-Exam\citgm\node_modules\tap\node_modules\@jridgewell\trace-mapping\node_modules\@jridgewell',
npm ERR! parent: 'tap'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hp\AppData\Roaming\npm-cache_logs\2023-10-11T13_44_54_583Z-debug.log

@gurvirbaraich
Copy link

gurvirbaraich commented Oct 12, 2023

Hi, I am trying to solve the issue can I have some help from the community. I believe there is an issue with Arborist package used by Npm to create dependancy tree.

What are your thoughts on to this.

@khanempire
Copy link

Hi, I am trying to solve the issue can I have some help from the community. I believe there is an issue with Arborist package used by Npm to create dependancy tree.

What are your thoughts on to this.

Did npm install working for u after cloning the repo?

@ljharb
Copy link
Contributor

ljharb commented Oct 12, 2023

Why npm ls --all and not just npm ls?

@gurvirbaraich
Copy link

Hi, I am trying to solve the issue can I have some help from the community. I believe there is an issue with Arborist package used by Npm to create dependancy tree.
What are your thoughts on to this.

Did npm install working for u after cloning the repo?

Yes.

@gurvirbaraich
Copy link

Why npm ls --all and not just npm ls?

npm ls seems to work fine but npm ls --all throws an error.

@ljharb
Copy link
Contributor

ljharb commented Oct 12, 2023

npm ls covers all dependencies; i'm not sure what npm ls --all does.

@targos
Copy link
Contributor Author

targos commented Oct 12, 2023

I don't know why it's only with --all but that's not really relevant in the end. The source of the problem is not with the ls command, it's with the install.

@ljharb
Copy link
Contributor

ljharb commented Oct 12, 2023

I suppose that's true; I'm just confused why you'd be using --all in the first place when npm ls alone checks the entire dep graph's validity.

@targos
Copy link
Contributor Author

targos commented Oct 12, 2023

pkgjs/action@a8a4894

It seems the goal was just to print the entire tree, not to check its validity.

@gurvirbaraich
Copy link

I don't know why it's only with --all but that's not really relevant in the end. The source of the problem is not with the ls command, it's with the install.

I believe there is an issue with creating a tree. It creates and invalid tree and installs packages with wrong dependancies. The problem is with the install command -> Arborist package.

@khanempire
Copy link

npm ls will not print the entire dependency of package

@muhaarif
Copy link

muhaarif commented Nov 15, 2023

I have cloned this code git clone https://github.com/nodejs/citgm.git and npm install, after that checked this command npm ls --all

i got error
_"npm ERR! code ELSPROBLEMS
npm ERR! invalid: wrap-ansi@6.2.0 /home/citgm/node_modules/tap/node_modules/wrap-ansi

npm ERR! A complete log of this run can be found in:
npm ERR! /home/tathkarah/.npm/logs/2023-11-15T13_47_42_162Z-debug-0.log"

So i tried to manual install,
npm install wrap-ansi@latest
or
rm -rf node_modules
rm package-lock.json
npm install

after that i check this command npm ls --all there is no error.

@koooge
Copy link

koooge commented Nov 22, 2023

Hi there,

I encountered ELSPROBLEMS with npm ls --all npm@10.1.0. It looks like it fails because there are packages installed by npm install --legacy-peer-deps in my case.

$ npm ls --all
...
│ │ ├── react-dom@18.2.0 deduped invalid: "^16.8.3" from node_modules/react-vis
│ │ ├── react@18.2.0 deduped invalid: "^16.8.3" from node_modules/react-vis

My package.json has the overrides like:

    "overrides": {
        "react-vis": {
            "react": "*",
            "react-dom": "*"
        },

ELSPROBLEMS does not happen with npm@8. So perhaps npm@10 does not evaluate "overrides"?

@koooge
Copy link

koooge commented Nov 22, 2023

I created a repo for the repro. https://github.com/koooge/npm-cli-6856

@muhaarif
Copy link

  • I have checked using this node version

node -v
v10.24.1
and updated react version

"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-vis": "^1.12.1"
},
"overrides": {
"react-vis": {
"react": "",
"react-dom": "
"
},
"react-motion": {
"react": "*"
}
}

and use this
rm -rf node_modules
rm package-lock.json
npm install

  • It's working

npm ls --all
npm-cli-6856@1.0.0 /home/tathkarah/Documents/Tathkarah/poc/npm-cli-6856
├─┬ react@16.14.0
│ ├─┬ loose-envify@1.4.0
│ │ └── js-tokens@4.0.0
│ ├── object-assign@4.1.1
│ └─┬ prop-types@15.8.1
│ ├── loose-envify@1.4.0 deduped
│ ├── object-assign@4.1.1 deduped
│ └── react-is@16.13.1
├─┬ react-dom@16.14.0
│ ├── loose-envify@1.4.0 deduped
│ ├── object-assign@4.1.1 deduped
│ ├── prop-types@15.8.1 deduped
│ └─┬ scheduler@0.19.1
│ ├── loose-envify@1.4.0 deduped
│ └── object-assign@4.1.1 deduped
└─┬ react-vis@1.12.1
├─┬ d3-array@3.2.4
│ └── internmap@2.0.3
├── d3-collection@1.0.7
├── d3-color@3.1.0
├─┬ d3-contour@4.0.2
│ └── d3-array@3.2.4 deduped
├── d3-format@3.1.0
├─┬ d3-geo@3.1.0
│ └── d3-array@3.2.4 deduped
├── d3-hexbin@0.2.2
├── d3-hierarchy@3.1.2
├─┬ d3-interpolate@3.0.1
│ └── d3-color@3.1.0 deduped
├─┬ d3-sankey@0.12.3
│ ├─┬ d3-array@2.12.1
│ │ └── internmap@1.0.1
│ └─┬ d3-shape@1.3.7
│ └── d3-path@1.0.9
├─┬ d3-scale@4.0.2
│ ├── d3-array@3.2.4 deduped
│ ├── d3-format@3.1.0 deduped
│ ├── d3-interpolate@3.0.1 deduped
│ ├─┬ d3-time@3.1.0
│ │ └── d3-array@3.2.4 deduped
│ └─┬ d3-time-format@4.1.0
│ └── d3-time@3.1.0 deduped
├─┬ d3-shape@3.2.0
│ └── d3-path@3.1.0
├── d3-voronoi@1.1.4
├─┬ deep-equal@1.1.2
│ ├─┬ is-arguments@1.1.1
│ │ ├─┬ call-bind@1.0.5
│ │ │ ├── function-bind@1.1.2
│ │ │ ├─┬ get-intrinsic@1.2.2
│ │ │ │ ├── function-bind@1.1.2 deduped
│ │ │ │ ├── has-proto@1.0.1
│ │ │ │ ├── has-symbols@1.0.3 deduped
│ │ │ │ └─┬ hasown@2.0.0
│ │ │ │ └── function-bind@1.1.2 deduped
│ │ │ └─┬ set-function-length@1.1.1
│ │ │ ├── define-data-property@1.1.1 deduped
│ │ │ ├── get-intrinsic@1.2.2 deduped
│ │ │ ├─┬ gopd@1.0.1
│ │ │ │ └── get-intrinsic@1.2.2 deduped
│ │ │ └── has-property-descriptors@1.0.1 deduped
│ │ └─┬ has-tostringtag@1.0.0
│ │ └── has-symbols@1.0.3
│ ├─┬ is-date-object@1.0.5
│ │ └── has-tostringtag@1.0.0 deduped
│ ├─┬ is-regex@1.1.4
│ │ ├── call-bind@1.0.5 deduped
│ │ └── has-tostringtag@1.0.0 deduped
│ ├─┬ object-is@1.1.5
│ │ ├── call-bind@1.0.5 deduped
│ │ └─┬ define-properties@1.2.1
│ │ ├─┬ define-data-property@1.1.1
│ │ │ ├── get-intrinsic@1.2.2 deduped
│ │ │ ├── gopd@1.0.1 deduped
│ │ │ └── has-property-descriptors@1.0.1 deduped
│ │ ├─┬ has-property-descriptors@1.0.1
│ │ │ └── get-intrinsic@1.2.2 deduped
│ │ └── object-keys@1.1.1 deduped
│ ├── object-keys@1.1.1
│ └─┬ regexp.prototype.flags@1.5.1
│ ├── call-bind@1.0.5 deduped
│ ├── define-properties@1.2.1 deduped
│ └─┬ set-function-name@2.0.1
│ ├── define-data-property@1.1.1 deduped
│ ├── functions-have-names@1.2.3
│ └── has-property-descriptors@1.0.1 deduped
├─┬ global@4.4.0
│ ├─┬ min-document@2.19.0
│ │ └── dom-walk@0.1.2
│ └── process@0.11.10
├── prop-types@15.8.1 deduped
└─┬ react-motion@0.5.2
├── performance-now@0.2.0
├── prop-types@15.8.1 deduped
└─┬ raf@3.4.1
└── performance-now@2.1.0

@Santoshraj2
Copy link
Contributor

Santoshraj2 commented Apr 3, 2024

Hi @targos

I tried to reproduce in mention npm version 10.1.0 as well as in latest. I don't see this is reproducible.
Also tried in both Windows and Mac OS. Can you please recheck and confirm if issue still exists.

Screenshot 2024-04-03 at 12 57 29 PM

@Santoshraj2
Copy link
Contributor

Screenshot 2024-04-03 at 1 24 40 PM

@Santoshraj2 Santoshraj2 self-assigned this Apr 3, 2024
@targos
Copy link
Contributor Author

targos commented Apr 8, 2024

Unfortunately, I think it's not reproducible because the dependency tree has changed since I opened this issue. We need to find another reproduction.

@Santoshraj2
Copy link
Contributor

closing this, as its not reproducible.

@targos
Copy link
Contributor Author

targos commented Apr 8, 2024

It is probably reproducible, just not with the initial steps.

@koooge
Copy link

koooge commented Apr 8, 2024

It still happens.

I created a repo for the repro. https://github.com/koooge/npm-cli-6856

Try this with npm@10.5.1. (Not node@10 )

@Ei-Dolon
Copy link

Ei-Dolon commented Jul 9, 2024

Fixed my ELSPROBLEMS with npm cache verify, npm prune

My SPA DApp project had suddenly developed some High Severity errors when it was found out the ws (websocket) library could be affected by DoS (Denial-of-Service) attacks. The websocket protocol is a persistent bi-directional communication link, that we needed between out DApp backend and the provider of our data access to the bsc blockchain.

The result of my trying to update, depreciate, swapping dependencies to avoid these errors caused more problems.
I got to the point where I decided to do a clean install and delete the node-modules directory and package-lock.json:

rm -rf node_modules package-lock.json
npm install

This did not help, so error messages were changed, that's about all, so i tried the audit:

npm audit
npm audit fix

I did not try the npm audit fix --force modifier as I had read that it generally makes the situation worse.
The result of:

npm ls

Listed the modules though with extraneous after many, then the tree format broke displaying:

npm **error** _code_ ELSPROBLEMS  
npm error extraneous: @stablelib/ed25519@1.0.3ended with ...  

Then I remember reading about the cache often needed cleaning, this from npm@5 is no longer true, but i did figure out that:

npm cache verify
npm prune

Fixed my errors, fixed the dependencies and the devDependencies, and gave a clean read out on npm ls.
Hope this same repair will work for at least some...

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 9.x work is associated with a specific npm 9 release Release 10.x
Projects
None yet
Development

No branches or pull requests

9 participants