I want to use the cytoscape library to visualize a protein-protein interaction network. I have already installed the node.js as well as the npm. However when I run this line (import cytoscape from ‘cytoscape’;) I receive the following error message. Does anyone faced the same problem or can help me to fix it?
The error message:
C:Program Filesnodejsnode.exe .sample_network.js
(node:5016) 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)
Uncaught SyntaxError C:UserselevaDesktopsample_network.js:5
import cytoscape from ‘cytoscape’;
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at executeUserEntryPoint (node:internal/modules/run_main:174:12)
at (node:internal/main/run_main_module:28:49)
I tried to uninstall the cytoscape from cmd and installed it again. Then I run the code again but the problem insists.
user_ele is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.