After updating our GitHub Action to @actions/core 1.2.6 (per the add-path deprecation notice), our Action builds are failing. The specific error is due to @actions/core/lib/command.js being unable to import utils.js. You can see the failing builds here, and I've also reproduced the relevant part of the log below.
This doesn't appear to be related to our usage of the @actions/core package, but rather an import failure. I've tried to rule out anything specific to our build that could be causing this and unfortunately I'm fresh out of ideas.
Error: Cannot find module './utils'
Require stack:
- /home/runner/work/cli-action/cli-action/node_modules/@actions/core/lib/command.js
- /home/runner/work/cli-action/cli-action/node_modules/@actions/core/lib/core.js
- /home/runner/work/cli-action/cli-action/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
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.<anonymous> (/home/runner/work/cli-action/cli-action/node_modules/@actions/core/lib/command.js:11:17)
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)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/work/cli-action/cli-action/node_modules/@actions/core/lib/command.js',
'/home/runner/work/cli-action/cli-action/node_modules/@actions/core/lib/core.js',
'/home/runner/work/cli-action/cli-action/index.js'
]
@Piccirello , for some reason your PR doesn't appear to have any of the generated utils.js files from the @actions/core 1.2.6 node module. You need to check those in. You may need to delete the node_modules folder and try to npm install again.
If you create a new folder and run
npm init
npm install @actions/core
ls node_modules/@actions/core/lib
You should see that the node module comes with more files then your branch appears to have.
command.d.ts command.js.map core.js file-command.d.ts file-command.js.map utils.js
command.js core.d.ts core.js.map file-command.js utils.d.ts utils.js.map
That being said, thats definitely one of the more unique problems I've seen sorry to hear you are running into it 馃槥
You're right, it seems performing a force add brought in those new files (git add -f node_modules/). I'm not sure why that was needed since our .gitignore doesn't seem to exclude anything related. Thanks for helping debug this @thboop, and apologies for the unnecessary Issue.
No worries, glad to hear its working for you 馃槃 !
Most helpful comment
You're right, it seems performing a force add brought in those new files (
git add -f node_modules/). I'm not sure why that was needed since our .gitignore doesn't seem to exclude anything related. Thanks for helping debug this @thboop, and apologies for the unnecessary Issue.