You are not logged in.
I have recently installed a package I needed using npm. It's a language package for the cspell spellcheck utility, cspell/dict-de-de.
Ever since I did that, I can't update my system anymore. When I try to update using Pacman, I get the following error message:
error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/docs/output/configuring-npm/npm-global.html exists in filesystem
npm: /usr/lib/node_modules/npm/docs/output/configuring-npm/npm-json.html exists in filesystem
npm: /usr/lib/node_modules/npm/lib/utils/output-error.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/packument-cache.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@sigstore/sign/dist/external/fetch.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/pacote/bin/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/pacote/lib/util/protected.js exists in filesystem
Errors occurred, no packages were upgraded.
I found a couple of threads previously regarding the same issue. In one of those threads, it says that I should install npm manually from scratch, is that what I should do? If so, what are specifically the binaries I need to download from the link posted in that thread?
Last edited by fschmitt (2024-06-14 10:08:17)
Offline
You should never use a tools own package manager (e.g. npm, pip, gem, etc.) to install packages system-wide, otherwise you'll inevitably run into problems like this.
If you haven't already, remove the package(s) you installed system-wide with npm, then see what conflicts still remain. Remove those files manually, then you'll be able to update your system.
If you still need these npm packages system-wide, look into creating a pacman package for them, e.g. https://aur.archlinux.org/packages/nodejs-cspell
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Okay, so I managed to remove all of npm to make my system update again. Now, I would want to install npm again and get my spellcheck working again. I installed npm using pacman, and that worked fine. Now, when I try to do
npm install cspell
I get the error "cannot find module nopt" Then I try to install the stuff it claims is missing
npm install nopt
or
npm install npm
I get another error:
/usr/lib/node_modules/npm/lib/cli/validate-engines.js:31
throw err
^
Error: Cannot find module 'nopt'
Require stack:
- /usr/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js
- /usr/lib/node_modules/npm/lib/npm.js
- /usr/lib/node_modules/npm/lib/cli/entry.js
- /usr/lib/node_modules/npm/lib/cli.js
- /usr/lib/node_modules/npm/bin/npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
at Module._load (node:internal/modules/cjs/loader:1012:27)
at Module.require (node:internal/modules/cjs/loader:1271:19)
at require (node:internal/modules/helpers:123:16)
at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:4:14)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
at Module.load (node:internal/modules/cjs/loader:1249:32)
at Module._load (node:internal/modules/cjs/loader:1065:12)
at Module.require (node:internal/modules/cjs/loader:1271:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js',
'/usr/lib/node_modules/npm/lib/npm.js',
'/usr/lib/node_modules/npm/lib/cli/entry.js',
'/usr/lib/node_modules/npm/lib/cli.js',
'/usr/lib/node_modules/npm/bin/npm-cli.js'
]
}
Node.js v22.2.0
How can I properly get npm working?
Offline
Okay, so I managed to remove all of npm to make my system update again.
That's not quite what I suggested, but okay. Let's see what state your pacman-managed node-related packages are in now. Please post the output of the following:
pacman -Qs '(npm|nodejs)'
pacman -Qkk $(pacman -Qqs '(npm|nodejs)')
type -a npm
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
First one:
local/nodejs 22.2.0-1
Evented I/O for V8 javascript
local/nodejs-material-design-icons 3.0.1-5
Material Design icons by Google
local/nodejs-nopt 7.2.0-1
Node/npm Option Parsing library
local/npm 10.8.0-1
A package manager for JavaScript
local/openpmix 5.0.2-1
Extended version of the PMI standard
local/semver 7.6.2-1
The semantic version parser used by npm
Second one gets a ton of error messages, so I won't post everything. It complains about a ton of "no such file or directory", and it ends with:
nodejs-material-design-icons: 97884 total files, 97817 altered files
warning: nodejs-nopt: /usr/bin/nopt (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/LICENSE (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/README.md (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/package.json (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/bin (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/bin/nopt.js (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/lib (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/lib/debug.js (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/lib/nopt-lib.js (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/lib/nopt.js (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/lib/type-defs.js (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules/abbrev (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules/abbrev/LICENSE (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules/abbrev/README.md (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules/abbrev/package.json (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules/abbrev/lib (No such file or directory)
warning: nodejs-nopt: /usr/lib/node_modules/nopt/node_modules/abbrev/lib/index.js (No such file or directory)
nodejs-nopt: 27 total files, 19 altered files
npm: 2355 total files, 0 altered files
openpmix: 247 total files, 0 altered files
semver: 67 total files, 0 altered files
(I didn't get xclip to copy the output, if you need everything, let me know and I'll figure out a way to get everything)
Third one:
npm is /usr/bin/npm
Last edited by fschmitt (2024-06-13 16:07:20)
Offline
At the very least, nodejs-material-design-icons and nodejs-nopt are damaged, you'll need to reinstall those (using pacman). If nodejs had any altered files, reinstall that too.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Hey, thank you very much for your help already, at least the pacman trouble seems to be fixed now.
However, I would still need a little instruction to get the cspell package working (which is what initially caused all this trouble). I installed cspell globally (using npm install -g), which seems to be what initially caused all this trouble if I understood you correctly. Now, if I just do "npm install cspell" in my command line, it is not found as a command when I try to execute it from the command line.
How should I go about installing it, without breaking my pacman again?
Offline
Offline
Now I seem to have everything working. I installed cspell from the AUR, but to install the german language dictionary, I didn't find a way to install it from AUR, so I still installed it using npm global, but pacman seems to be happy with it, and it works.
Thank you a lot for your patience, you really helped me out here, appreciate it!
Also, I don't know if that's a thing as I haven't used the forum much, but my issue is solved, so this thread can be closed.
Offline
You can probably also adapt the PKGBUILD from the cspell AUR to globally install dictionaries.
Please mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline