node.jsangulartypescriptgithubgithub-actions

Github Action with Angular is failing due to @rollup/rollup-linux-x64-gnu


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:

enter image description here

enter image description here

And here is my .yml:

enter image description here

And there are my scripts:

enter image description here

am I doing something wrong?

I have tried with other node versions and caching npm.


Solution

  • 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": "*"
    }