I'm facing the following error when the pipeline in my GitHub actions is running:
An unhandled exception occurred: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try
npm i
again after removing both package-lock.json and node_modules directory.
This error is shown up when I run the test or even the build:
And here is my .yml:
And there are my scripts:
am I doing something wrong?
I have tried with other node versions and caching npm
.
This problem is quite common, see this thread if you want the full explanation and all possible solutions.
Adding this to the package.json
and running npm i
again will usually fix it in most cases:
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "*"
}