SOLUTION HERE (by @just_another_person@lemmy.world): https://lemmy.abnormalbeings.space/post/804932?scrollToComments=true
You have a dependency discrepancy with your local node modules and your global. You should be running this in a node virtual environment so all of the local projects dependencies don’t conflict with global.
https://stackoverflow.com/questions/3653495/is-there-a-virtual-environment-for-node-js
https://www.develves.net/blogs/asd/2016-04-28-using-virtual-environments-nodejs/
cross-posted from: https://lemmy.abnormalbeings.space/post/804932
I have searched around for answers to this, but so far, the solutions I found and tried have not been working for me. Thankfully, the update isn’t that critical, so time is not of the essence as of now. But I fear, the problem will only persist.
So, bit of a headscratcher: I am following the guide to upgrade (no Docker) from here.
Simple enough, right? Sadly, I keep getting:
~/live$ RAILS_ENV=production bundle exec rails assets:precompile
I, [2025-04-03T20:30:30.072648 #981372] INFO -- : [dotenv] Loaded .env.production
Mastodon and Webpacker requires Yarn ">=4 <5" and you are using 1.22.22
Exiting!
So, the proposed solution? Using corepack as intended. That, at first, upon entering “corpack prepare” and “corepack enable” in succession, seemed to run silently and without errors/warnings.
But it changed nothing at all for the error message. Prompting me to search around, haphazardly try to apply fixes, trying to remove and reinstall yarn, “the usual”. My last attempt was to globally remove yarn and corepack with npm and then re-install both. Since then, a new, exciting error is happening:
~/live$ corepack enable
Internal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -'/usr/bin/pnpm'
at async Object.symlink (node:internal/fs/promises:1005:10)
at async EnableCommand.generatePosixLink (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:23156:5)
at async Promise.all (index 0)
at async EnableCommand.execute (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:23143:5)
at async EnableCommand.validateAndExecute (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:20258:22)
at async _Cli.run (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:21195:18)
at async Object.runMain (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:23642:19)
Oh, and when trying to install yarn and corepack, now, I get:
~/live$ npm install yarn
npm error code EUNSUPPORTEDPROTOCOL
npm error Unsupported URL Type "patch:": patch:babel-plugin-lodash@npm%3A3.3.4#~/.yarn/patches/babel-plugin-lodash-npm-3.3.4-c7161075b6.patch
npm error A complete log of this run can be found in: /home/mastodon/.npm/_logs/2025-04-03T19_54_12_827Z-debug-0.log
~/live$ npm install corepack
npm error code EUNSUPPORTEDPROTOCOL
npm error Unsupported URL Type "patch:": patch:babel-plugin-lodash@npm%3A3.3.4#~/.yarn/patches/babel-plugin-lodash-npm-3.3.4-c7161075b6.patch
npm error A complete log of this run can be found in: /home/mastodon/.npm/_logs/2025-04-03T19_54_25_678Z-debug-0.log
the logs in question:
$ cat /home/mastodon/.npm/_logs/2025-04-03T19_54_12_827Z-debug-0.log
0 verbose cli /usr/bin/node /usr/bin/npm
1 info using npm@11.2.0
2 info using node@v22.14.0
3 silly config load:file:/usr/lib/node_modules/npm/npmrc
4 silly config load:file:/home/mastodon/live/.npmrc
5 silly config load:file:/home/mastodon/.npmrc
6 silly config load:file:/usr/etc/npmrc
7 verbose title npm install yarn
8 verbose argv "install" "yarn"
9 verbose logfile logs-max:10 dir:/home/mastodon/.npm/_logs/2025-04-03T19_54_12_827Z-
10 verbose logfile /home/mastodon/.npm/_logs/2025-04-03T19_54_12_827Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
13 silly logfile done cleaning log files
14 silly idealTree buildDeps
15 verbose stack Error: Unsupported URL Type "patch:": patch:babel-plugin-lodash@npm%3A3.3.4#~/.yarn/patches/babel-plugin-lodash-npm-3.3.4-c7161075b6.patch
15 verbose stack at unsupportedURLType (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:369:15)
15 verbose stack at fromURL (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:428:13)
15 verbose stack at Function.resolve (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:110:12)
15 verbose stack at #nodeFromEdge (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1039:22)
15 verbose stack at #buildDepStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:35)
15 verbose stack at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
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)
15 verbose stack at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:149:5)
15 verbose stack at async Npm.exec (/usr/lib/node_modules/npm/lib/npm.js:208:9)
16 error code EUNSUPPORTEDPROTOCOL
17 error Unsupported URL Type "patch:": patch:babel-plugin-lodash@npm%3A3.3.4#~/.yarn/patches/babel-plugin-lodash-npm-3.3.4-c7161075b6.patch
18 silly unfinished npm timer reify 1743710053061
19 silly unfinished npm timer reify:loadTrees 1743710053064
20 silly unfinished npm timer idealTree:buildDeps 1743710057205
21 silly unfinished npm timer idealTree:#root 1743710057206
22 verbose cwd /home/mastodon/live
23 verbose os Linux 6.1.0-31-amd64
24 verbose node v22.14.0
25 verbose npm v11.2.0
26 verbose exit 1
27 verbose code 1
28 error A complete log of this run can be found in: /home/mastodon/.npm/_logs/2025-04-03T19_54_12_827Z-debug-0.log
~/live$ cat /home/mastodon/.npm/_logs/2025-04-03T19_54_25_678Z-debug-0.log
0 verbose cli /usr/bin/node /usr/bin/npm
1 info using npm@11.2.0
2 info using node@v22.14.0
3 silly config load:file:/usr/lib/node_modules/npm/npmrc
4 silly config load:file:/home/mastodon/live/.npmrc
5 silly config load:file:/home/mastodon/.npmrc
6 silly config load:file:/usr/etc/npmrc
7 verbose title npm install corepack
8 verbose argv "install" "corepack"
9 verbose logfile logs-max:10 dir:/home/mastodon/.npm/_logs/2025-04-03T19_54_25_678Z-
10 verbose logfile /home/mastodon/.npm/_logs/2025-04-03T19_54_25_678Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
13 silly logfile done cleaning log files
14 silly idealTree buildDeps
15 verbose stack Error: Unsupported URL Type "patch:": patch:babel-plugin-lodash@npm%3A3.3.4#~/.yarn/patches/babel-plugin-lodash-npm-3.3.4-c7161075b6.patch
15 verbose stack at unsupportedURLType (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:369:15)
15 verbose stack at fromURL (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:428:13)
15 verbose stack at Function.resolve (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:110:12)
15 verbose stack at #nodeFromEdge (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1039:22)
15 verbose stack at #buildDepStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:35)
15 verbose stack at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
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)
15 verbose stack at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:149:5)
15 verbose stack at async Npm.exec (/usr/lib/node_modules/npm/lib/npm.js:208:9)
16 error code EUNSUPPORTEDPROTOCOL
17 error Unsupported URL Type "patch:": patch:babel-plugin-lodash@npm%3A3.3.4#~/.yarn/patches/babel-plugin-lodash-npm-3.3.4-c7161075b6.patch
18 silly unfinished npm timer reify 1743710065916
19 silly unfinished npm timer reify:loadTrees 1743710065919
20 silly unfinished npm timer idealTree:buildDeps 1743710070343
21 silly unfinished npm timer idealTree:#root 1743710070344
22 verbose cwd /home/mastodon/live
23 verbose os Linux 6.1.0-31-amd64
24 verbose node v22.14.0
25 verbose npm v11.2.0
26 verbose exit 1
27 verbose code 1
28 error A complete log of this run can be found in: /home/mastodon/.npm/_logs/2025-04-03T19_54_25_678Z-debug-0.log
Thankfully, mastodon is still working, no database issues, nothing indicating I fucked up beyond repair yet.
I am a bit at a loss, unfortunately, but eager to use my fuckup as a learning experience - am glad to hear any and all more experienced folk chiming in!___