While using the following image
image: node:17.4.0
Getting errorr
+ yarn install
node:internal/modules/cjs/loader:936
Error: Cannot find module '/opt/atlassian/pipelines/agent/build/.yarn/releases/yarn-3.1.1.cjs'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Is there a workaround?
You can add the below to your scripts, this should update the version
yarn set version 3.1.1
Sadly it doesn't (if tried it already in different contexts - root-, build- and home-dir ...), always with the same error - i really don't know why it is looking for the latest node berry version, but i'm not a yarn/node expert:
+ yarn set version 3.1.1
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/opt/atlassian/pipelines/agent/build/.yarn/releases/yarn-3.1.1.cjs'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v17.4.0
The quick and dirty solution for me was to download yarn manually and put it on the place where node is looking for it until we have a real solution for this issue.
- mkdir -p /opt/atlassian/pipelines/agent/build/.yarn/releases
- curl -o /opt/atlassian/pipelines/agent/build/.yarn/releases/yarn-3.1.1.cjs https://repo.yarnpkg.com/3.1.1/packages/yarnpkg-cli/bin/yarn.js
- corepack enable
- yarn set version berry
I know it will only work for a limited time, so this is no real solution.
BR,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have the same problem when trying to migrate from Docker multistage builds to Bitbucket Pipelines.
Same docker image (I've compared the hashes) works locally and in Docker multi-stages builds with the same set of commands, only Bitbucket Pipelines fails.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As per the image details for `node 17.4.0`, it contains yarn `1.22.17` that is the older version (1.x).
For berry, which is the newer version you might need to create your own image replacing the yarn package.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.