On trying to import library in a javascript file (.js), Syntax error is thrown,
import deepEqual from "deep-equal";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:881:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
at Module.load (internal/modules/cjs/loader.js:798:32)
at Function.Module._load (internal/modules/cjs/loader.js:711:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:1014:10)
at internal/main/run_main_module.js:17:11
I am using nodejs to execute the file from command line. to execute I use:
node sample.js
Library installation update
npm version 6.11.3
node version 12.11.1
npm install deep-equal - completed