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
Hi. I have tried the following ways to run the index.js file in windows powershell (run as administrative), but I got error. Can you please advise what is going wrong and how I can solve the issue?
W2th node index.js, I got the error message:
(node:15284) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
C:\Users\sali8720\jsonld-vis-master\jsonld-vis-master\example\index.js:1
import d3 from 'd3';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
I then go to package.json, add "type":"module", and save. Then I run with the command node index.js again. This time, I got the following error.
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'd3' imported from C:\Users\sali8720\jsonld-vis-master\jsonld-vis-master\example\index.js
←[90m at packageResolve (internal/modules/esm/resolve.js:655:9)←[39m
←[90m at moduleResolve (internal/modules/esm/resolve.js:696:18)←[39m
←[90m at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)←[39m
←[90m at Loader.resolve (internal/modules/esm/loader.js:86:40)←[39m
←[90m at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)←[39m
←[90m at ModuleWrap. (internal/modules/esm/module_job.js:56:40)←[39m
←[90m at link (internal/modules/esm/module_job.js:55:36)←[39m {
code: ←[32m'ERR_MODULE_NOT_FOUND'←[39m
By using the original package.json, I changed the extension of index.js to index.mjs, and run node index.mjs.
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'd3' imported from C:\Users\sali8720\jsonld-vis-master\jsonld-vis-master\example\index.mjs
←[90m at packageResolve (internal/modules/esm/resolve.js:655:9)←[39m
←[90m at moduleResolve (internal/modules/esm/resolve.js:696:18)←[39m
←[90m at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)←[39m
←[90m at Loader.resolve (internal/modules/esm/loader.js:86:40)←[39m
←[90m at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)←[39m
←[90m at ModuleWrap. (internal/modules/esm/module_job.js:56:40)←[39m
←[90m at link (internal/modules/esm/module_job.js:55:36)←[39m {
code: ←[32m'ERR_MODULE_NOT_FOUND'←[39m
}
The text was updated successfully, but these errors were encountered:
Hi. I have tried the following ways to run the index.js file in windows powershell (run as administrative), but I got error. Can you please advise what is going wrong and how I can solve the issue?
(node:15284) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use
node --trace-warnings ...
to show where the warning was created)C:\Users\sali8720\jsonld-vis-master\jsonld-vis-master\example\index.js:1
import d3 from 'd3';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'd3' imported from C:\Users\sali8720\jsonld-vis-master\jsonld-vis-master\example\index.js
←[90m at packageResolve (internal/modules/esm/resolve.js:655:9)←[39m
←[90m at moduleResolve (internal/modules/esm/resolve.js:696:18)←[39m
←[90m at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)←[39m
←[90m at Loader.resolve (internal/modules/esm/loader.js:86:40)←[39m
←[90m at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)←[39m
←[90m at ModuleWrap. (internal/modules/esm/module_job.js:56:40)←[39m
←[90m at link (internal/modules/esm/module_job.js:55:36)←[39m {
code: ←[32m'ERR_MODULE_NOT_FOUND'←[39m
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'd3' imported from C:\Users\sali8720\jsonld-vis-master\jsonld-vis-master\example\index.mjs
←[90m at packageResolve (internal/modules/esm/resolve.js:655:9)←[39m
←[90m at moduleResolve (internal/modules/esm/resolve.js:696:18)←[39m
←[90m at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)←[39m
←[90m at Loader.resolve (internal/modules/esm/loader.js:86:40)←[39m
←[90m at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)←[39m
←[90m at ModuleWrap. (internal/modules/esm/module_job.js:56:40)←[39m
←[90m at link (internal/modules/esm/module_job.js:55:36)←[39m {
code: ←[32m'ERR_MODULE_NOT_FOUND'←[39m
}
The text was updated successfully, but these errors were encountered: