0

I am on Kubuntu 19.10. I installed npm via apt, and when I do anything (even simply npm -v), I get this error:

$ npm -v
internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module 'semver'
Require stack:
- /usr/share/npm/lib/utils/unsupported.js
- /usr/share/npm/bin/npm-cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
    '/usr/share/npm/lib/utils/unsupported.js',
    '/usr/share/npm/bin/npm-cli.js'
]
}

I tried a few suggested solutions such as reinstalling node and npm, force-deleting node modules, etc, but nothing worked.

It seems pretty broken to me, and I'm not sure how to fix it. Did anyone have a similar issue and know what could be the matter?

I did not have the same problem on Windows.

1

1 Answer 1

0

I sorted this out by following the instructions on this StackOverflow answer, i.e. downloading and setting it up manually.

It is very strange because I have another laptop with the same Kubuntu setup and I had no problems there. This, along with my other problem with winbind (which also happens on the same laptop and not the other one) has me wondering what could be different on this particular laptop that is resulting in what seems to be broken packages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .