Hello π
I'm in need of some help. I'm trying to use this within my local github action. I'm defaulting to the default environment for the action so I'm not compiling/transpiling. I was surprised when I saw this error since it's within the node_module
directory. I know github actions default to node 12. I'm wondering why it isn't picking up the compiled/transpiled code? I'm not sure if this is isolated to this repo or to all my node_modules
. I'm still investigating.
// <repo>/package.json
{
...
"dependencies": {
...
"to-semver": "^4.0.0"
}
}
// <repo>/actions/contentful-action/src/action.js
const toSemver = require('to-semver')
// github action error
/home/runner/work/<repo>/node_modules/to-semver/index.js:1
import semver from 'semver';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:895:18)
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)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/work/<repo>/.github/actions/contentful-action/src/action.js:7:18)
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)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/work/<repo>/.github/actions/contentful-action/src/index.js:3:23)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too