async-airtable
async-airtable copied to clipboard
SyntaxError: Cannot use import statement outside a module
Describe the bug
There's an issue when trying to use the module, it just doesn't work. Am I getting something very wrong? I used version 2.1.0 without any problems and now I tried 2.3.1 and it just won't work.
To Reproduce Steps to reproduce the behavior:
- create an empty folder and
cdinto it npm install asyncairtable- add
import { AsyncAirtable } from 'asyncairtable';to a blankindex.js node index.js
It will throw the following error:
/.../node_modules/asyncairtable/lib/asyncAirtable.js:10
import buildOpts from './buildOpts';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (.../index.js:1:23)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
Expected behavior The script should run without any output.
Node versions
Tested with Node 16.6.1 and 17.2.0 (using nvm) Npm version 7.20.3
I have the same issue.
I guess for now the solution is npm install [email protected]
This might be useful: "asyncairtable doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix." ;-)