You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to use the ontology-ts-sdk library in a Node.js environment, I encountered the error "Cannot use import statement outside a module." This error seems to be related to the library's internal usage of ES module syntax (import statements) conflicting with the CommonJS syntax used in Node.js environments.
/node_modules/@vespaiach/axios-fetch-adapter/index.js:1
import axios from 'axios';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (/node_modules/ontology-ts-sdk/lib/index.js:1:2593)
at r (/node_modules/ontology-ts-sdk/lib/index.js:1:124)
Node.js v18.19.0
The text was updated successfully, but these errors were encountered:
sinanouri
changed the title
"Cannot use import statement outside a module" error when using ontology-ts-sdk
"Cannot use import statement outside a module" error when using ontology-ts-sdk (@vespaiach/axios-fetch-adapter/index.js)
May 31, 2024
When attempting to use the ontology-ts-sdk library in a Node.js environment, I encountered the error "Cannot use import statement outside a module." This error seems to be related to the library's internal usage of ES module syntax (import statements) conflicting with the CommonJS syntax used in Node.js environments.
Steps to Reproduce:
Expected Behavior:
The application should run without errors, and the message "ontology sdk" should be logged to the console.
Actual Behavior:
The application throws a SyntaxError: "Cannot use import statement outside a module" at @vespaiach/axios-fetch-adapter/index.js.
Environment:
Package.json:
The Error:
The text was updated successfully, but these errors were encountered: