Caleb Yang
Caleb Yang

Reputation: 83

Internal/modules/cjs/loader.js: 584 error

I am facing an error when I am running npm commands for running a umi app project. This is the error I see when I run the code.

I have tried checking the node module for the loader.js file but I have not been able to find it.

internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module '@nodelib/fs.stat'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\cyhc9\umiapp\node_modules\fast-glob\out\adapters\fs-stream.js:17:14)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

The code should run when I run npm commands or the project commands.

Upvotes: 3

Views: 7231

Answers (1)

Mr. Dang
Mr. Dang

Reputation: 575

Possible solutions:

  1. Try not to have space in your directory name, i.e.: fun project/nestjs/..., try this: fun-project/nestjs/....
  2. Remove node_modules and package-lock.json then do npm install again to see if that solve the problem.
  3. Clear node cache by npm cache clean --force then repeat step number 2.
  4. Keep trying npm i again.
  5. Buy a new computer.

Good luck.

Upvotes: 4

Related Questions