Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating @actions/core to 1.2.6 results in module import failure #600

Closed
Piccirello opened this issue Oct 7, 2020 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@Piccirello
Copy link

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 Piccirello added the bug Something isn't working label Oct 7, 2020
@Piccirello Piccirello changed the title Update @actions/core from 1.2.4 to 1.2.6 Updating @actions/core to 1.2.6 results in module import failure Oct 7, 2020
@thboop
Copy link
Collaborator

thboop commented Oct 7, 2020

@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 😞

@Piccirello
Copy link
Author

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.

@thboop
Copy link
Collaborator

thboop commented Oct 7, 2020

No worries, glad to hear its working for you 😄 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants