Menu

Showing posts with label Node.js. Show all posts
Showing posts with label Node.js. Show all posts

ExperimentalWarning: The ESM module loader is experimental

Node.js has two module systems: CommonJS modules and ECMAScript modules.
Authors can tell Node.js to use the ECMAScript modules loader via the .mjs file extension, the package.json "type" field, or the --input-type flag. Outside of those cases, Node.js will use the CommonJS module loader.

Cannot find module commander in Node

 

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (E:\assignment\DynamoDBtoCSV\dynamoDBtoCSV.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)


How to fix cannot find module commander error?

To install the commander module you need to run the below npm install command.

npm install commander

OR 

npm install commander --save


After executing the above command, the Node commander module will get downloaded and save locally in the machine. Below is the snapshot of successful execution.

E:\assignment\DynamoDBtoCSV>npm install commander --save
npm notice created a lockfile as package-lock.json. You should commit this file.
+ commander@6.1.0
added 1 package from 1 contributor and audited 1 package in 1.489s
found 0 vulnerabilities

Why we need Python to run Node.js?

Node.js is written on c++, and is build on GYP. GYP is a Meta-Build system: a build system that generates other build systems and help us to build the large project that needs multiple platform to build. GYP is developed and written using Python, so to build and run few modules of Node.js we need Python.

Therefore wherever we need node-gyp to build any node module, Python will be required.

References: