Home > Enterprise >  Truffle init returns cannot find module
Truffle init returns cannot find module

Time:03-20

After installing nodejs, I created a directory, installed truffle, but after typing the command "truffle init" it return this error. I've tried everything, but this doesn't go away. I've reinstalled yet it's the same. Pls how do i fix node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'C:\Users\lawrence david\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

CodePudding user response:

Delete node_modules and run npm install again

CodePudding user response:

I've solved the issue. All you need to do is to run "npm install -g [email protected]" This will install an older version of truffle. Turns out the issue is with "npm install -g truffle" since it installs the latest version, and the latest version is currently having glitches.

Just run "npm install -g [email protected]" or an older version of truffle and your issue will be solved.

  • Related