-
Notifications
You must be signed in to change notification settings - Fork 223
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
Unable to use with node >v13.2.x #205
Comments
@steelerc69 are you seeing this when developing on |
@ianstormtaylor I get this error when importing superstruct into my codebase on Node v12.13.1 |
@jdolearydl on Node 12? Are you running it with custom flags? |
No custom flags, I'm using the docker image |
@jdolearydl I can't reproduce that on |
See if the latest release |
Sorry for the slow response. I'm importing this into my code. We found if we rolled back to v12.x using nvm it works. We were not using nvm prior to this. We are on MacOS Catalina and AWS Lambda where this is running. I will try latest later today or tomorrow. Thanks |
Just tried and whatever change was implemented resolved my issue. Thanks for the quick turn around. |
@ianstormtaylor It must've just been the warning |
Only sure that this breaks with v13.2
Build runs fine (yarn build)
When running, I receive error:
(node:49773) Warning: require() of ES modules is not supported.
require() of /node_modules/superstruct/lib/index.js from /dist/functions/hasura/notifications/handlers/subscription-status-completed.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node_modules/superstruct/package.json.
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /node_modules/superstruct/lib/index.js
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:13)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at Object. (/src/functions/hasura/notifications/handlers/subscription-status-completed.ts:17:1)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at AwsInvokeLocal.invokeLocalNodeJs (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:600:33)
at AwsInvokeLocal.invokeLocal (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:155:19)
at AwsInvokeLocal.tryCatcher (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/Cellar/serverless/1.54.0/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:439:21)
at process.topLevelDomainCallback (domain.js:130:23) {
code: 'ERR_REQUIRE_ESM'
}
When running code without serverless I still receive the issue, error is:
(node:50691) Warning: require() of ES modules is not supported.
require() of /node_modules/superstruct/lib/index.js from /dist/functions/hasura/notifications/handlers/subscription-status-completed.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node_modules/superstruct/package.json.
internal/modules/cjs/loader.js:1156
throw new ERR_REQUIRE_ESM(filename);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /node_modules/superstruct/lib/index.js
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:13)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at Object. (/dist/functions/hasura/notifications/handlers/subscription-status-completed.js:16:23)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14) {
code: 'ERR_REQUIRE_ESM'
}
The text was updated successfully, but these errors were encountered: