Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom GitHub Action failing with MODULE_NOT_FOUND

I have a basic custom js GitHub action which is executing a fetch call to an API. However, I'm getting a MODULE_NOT_FOUND error. I've tried different versions of node-fetch etc but haven't been able resolve the error. Has anyone encountered this error? And if so do you know how to resolve?

My Action repository is https://github.com/ReleaseNotesHub/GitHubPullAction

Error Error: Cannot find module '/home/runner/work/GitHubPullAction/GitHubPullAction/node_modules/is-plain-object/dist/is-plain-object.js'. Please verify that the package.json has a valid "main" entry at tryPackage (internal/modules/cjs/loader.js:297:19) at Function.Module._findPath (internal/modules/cjs/loader.js:528:18) at Function.Module._resolveFilename (internal/modules/cjs/loader.js:784:27) at Function.Module._load (internal/modules/cjs/loader.js:690:27) at Module.require (internal/modules/cjs/loader.js:852:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/home/runner/work/GitHubPullAction/GitHubPullAction/node_modules/@octokit/endpoint/dist-node/index.js:5:21) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32) { code: 'MODULE_NOT_FOUND', path: '/home/runner/work/GitHubPullAction/GitHubPullAction/node_modules/is-plain-object/package.json', requestPath: 'is-plain-object' }

like image 982
PatrickNolan Avatar asked Oct 27 '25 14:10

PatrickNolan


1 Answers

The file node_modules/is-plain-object/dist/is-plain-object.js (which it's looking for) is not in your git repo. It's in your local client, but git add . is ignoring it because dist/ is in your .gitignore. This is a very default setup, but it breaks github actions.

like image 72
dspeyer Avatar answered Oct 29 '25 06:10

dspeyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!