yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.37k stars 2.72k forks source link

Error on cicd but working on local #8991

Open datahealer opened 9 months ago

datahealer commented 9 months ago

Error ---------------------------------------------------

Error: yarn install --non-interactive --frozen-lockfile failed with code 1 at ChildProcess. (/github/workspace/node_modules/serverless-webpack/lib/utils.js:91:16) at ChildProcess.emit (node:events:513:28) at ChildProcess.emit (node:domain:489:12) at maybeClose (node:internal/child_process:1100:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)

using versions: yarn : 1.22.19 "webpack": "^5.88.2", "webpack-node-externals": "^3.0.0", "fork-ts-checker-webpack-plugin": "^3.0.1", "serverless-webpack": "^5.13.0",

juliushuck commented 7 months ago

I had a similar problem after I upgraded to yarn 4.0.1 installed by corepack. I was not able to run yarn --immutable in CI. It always kept saying, that it would have to change the lockfile.

See my error here

Step #0 - "Build":  ---> Running in 497d47b48660
Step #0 - "Build": Removing intermediate container 497d47b48660
Step #0 - "Build":  ---> 9e2bbfd989a8
Step #0 - "Build": Step 10/24 : RUN yarn install --immutable
Step #0 - "Build":  ---> Running in e4c4b7446af1
Step #0 - "Build": ➤ YN0000: · Yarn 4.0.1
Step #0 - "Build": ➤ YN0000: ┌ Resolution step
Step #0 - "Build": ➤ YN0085: │ - @0no-co/graphql.web@npm:1.0.4, @ampproject/remapping@npm:2.2.1, @babel/code-frame@npm:7.10.4, @babel/compat-data@npm:7.23.2, @babel/core@npm:7.23.2, and 799 more.
Step #0 - "Build": ➤ YN0000: └ Completed in 0s 321ms
Step #0 - "Build": ➤ YN0000: ┌ Post-resolution validation
Step #0 - "Build": ➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.
Step #0 - "Build": ➤ YN0000: └ Completed
Step #0 - "Build": ➤ YN0000: · Failed with errors in 0s 522ms
Step #0 - "Build": The command '/bin/sh -c yarn install --immutable' returned a non-zero code: 1
Finished Step #0 - "Build"

I removed global yarn installations, cleared caches, removed lockfiles, pnp files. And still no luck.

I transferred my project to pnpm workspaces and now everything is working again. Maybe in the process of switching I fixed sth else, but for now I'm happy that my project is back up and running.

brianbauer42 commented 5 months ago

I have an issue that sounds like the same thing as @datahealer and we use the same version 1.22.19.

When we run yarn --no-cache --frozen-lockfile (in our build pipeline or locally) it will fail saying that the lock file needs to be updated. However, if we run yarn without the --frozen-lockfile option, the lockfile is not changed.

Any ideas on how to explore this further would be appreciated.