Cannot find module issue [solved]


throw err;

Error: Cannot find module ‘discord.js’

at Function.Module._resolveFilename (module.js:548:15)

at Function.Module._load (module.js:475:25)

at Module.require (module.js:597:17)

at require (internal/module.js:11:18)

at Object. (/app/index.js:2:17)

at Module._compile (module.js:653:30)

at Object.Module._extensions..js (module.js:664:10)

at Module.load (module.js:566:32)

at tryModuleLoad (module.js:506:12)

at Function.Module._load (module.js:498:3)

discord.js already reserved in package.json, but i’m still getting this error even after doing enable-pnpm. Any solution?


You can get ‘cannot find module’ errors when there is in fact a different issue somewhere else in the package.json file. Let us know the project name and we’ll take a look. Thanks.


Thanks - it looks like you were using an older version of a package, which had a dependency which was 404ing. Updating your package fixed the issue and it’s working ok now. But let us know if you’re still having issues.


Thankyou! It works now.