% node init
node:internal/modules/cjs/loader:1051
throw err;
^
Error: Cannot find module '/Users/c2c/Desktop/node-examples/init'
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Module._load (node:internal/modules/cjs/loader:901:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.4.0
If you are trying to make use of the init command to initialize a project in NodeJs and you get an error like Cannot find module init then the first thing that you need to do is install the init module using npm command.
Fix:
npm install init

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!