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] Cannot find module '@npmcli/config' #6635

Closed
2 tasks done
natesire opened this issue Jul 9, 2023 · 7 comments · Fixed by #6844
Closed
2 tasks done

[BUG] Cannot find module '@npmcli/config' #6635

natesire opened this issue Jul 9, 2023 · 7 comments · Fixed by #6844
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@natesire
Copy link

natesire commented Jul 9, 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

It looks like the require of that config package isn't loading. This is a clean install.

Node v20.3.1

I cannot run any npm cli commands either. This happened around the same time debugging workspaces and Windows path problems.

Expected Behavior

No response

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm:
  • Node.js:
  • OS Name: Windows 11
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here

Cannot run npm commands.

@natesire natesire added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Jul 9, 2023
@TimB87
Copy link

TimB87 commented Jul 19, 2023

still happening with facda25

@polyzen
Copy link

polyzen commented Jul 19, 2023

You have to first run node scripts/resetdeps.js.

@TimB87
Copy link

TimB87 commented Jul 20, 2023

@polyzen thank you!
Using the tarball it throws another error for not having a git repository:

+ node scripts/resetdeps.js
INFO spawn git checkout node_modules/
fatal: not a git repository (or any of the parent directories): .git
ERRO GitUnknownError: An unknown git error occurred
ERRO     at makeError (/home/pkgmk/work/npm/src/cli-9.8.1/node_modules/@npmcli/git/lib/make-error.js:28:13)
ERRO     at /home/pkgmk/work/npm/src/cli-9.8.1/node_modules/@npmcli/git/lib/spawn.js:37:26
ERRO     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERRO     at async spawn (/home/pkgmk/work/npm/src/cli-9.8.1/scripts/util.js:72:11)
ERRO     at async cleanup (/home/pkgmk/work/npm/src/cli-9.8.1/scripts/resetdeps.js:6:3)
ERRO     at async main (/home/pkgmk/work/npm/src/cli-9.8.1/scripts/resetdeps.js:22:3)
ERRO     at async run (/home/pkgmk/work/npm/src/cli-9.8.1/scripts/util.js:166:17)
ERRO cmd: /usr/bin/git
ERRO args: --no-replace-objects checkout node_modules/
ERRO code: 128

Preferably, git wasn't a requirement. Is there a way around that?

@TimB87
Copy link

TimB87 commented Jul 22, 2023

What worked for me is moving the missing directories from workspaces to node_modules:

  cp -r workspaces/config node_modules/@npmcli/
  cp -r workspaces/libnpmfund node_modules/libnpmfund
  cp -r workspaces/arborist node_modules/@npmcli/arborist

that way I was able to execute node bin/npm-cli.js

@natesire
Copy link
Author

It seems that Node 18 fixed the issue but then the issue regressed in Node 20. I am looking at it again :) Thanks for all the awesome comments. So helpful.

@Raidoxe
Copy link

Raidoxe commented Jan 4, 2024

The only thing that worked for me was deleting my nodejs folder located in programfiles/nodejs and then my nvm folder located in user/AppData/Roaming/nvm. Then doing a complete re install of node js.

@NaomiN
Copy link

NaomiN commented Apr 18, 2024

I am getting this error all of the sudden and cannot run any npm commands. What should I do?

Error: Cannot find module '@npmcli/arborist'
Require stack:

  • C:\Program Files (x86)\Nodist\npmv\9.3.1\lib\npm.js
  • C:\Program Files (x86)\Nodist\npmv\9.3.1\lib\cli.js
  • C:\Program Files (x86)\Nodist\npmv\9.3.1\bin\npm-cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants