简体   繁体   中英

internal/modules/cjs/loader.js:800 throw err

Executed yarn install in my project folder and got below error.

internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'ts-node/register'
Require stack:
- internal/preload
?[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797
:15)?[39m
?[90m    at Function.Module._load (internal/modules/cjs/loader.js:690:27)?[39m
?[90m    at Module.require (internal/modules/cjs/loader.js:852:19)?[39m
?[90m    at Module._preloadModules (internal/modules/cjs/loader.js:1147:12)?[39m
?[90m    at loadPreloadModules (internal/bootstrap/pre_execution.js:443:5)?[39m
?[90m    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:62:3
)?[39m
?[90m    at internal/main/run_main_module.js:7:1?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
requireStack: [ ?[32m'internal/preload'?[39m ]
}

Removed node_module, yarn.lock and node-cache. But no success.

This error is not project specific. If i run yarn, node or npm anywhere in my system I'm getting above error. Is my node and yarn package corrupted?

Solved Issue by checking NODE_OPTIONS

Run echo %NODE_OPTIONS% and got ts-node/register .

So, to remove ts-node/register run setx NODE_OPTIONS ""

After this node,npm and yarn are working properly.

Try following command:

Step 1 : remove node_modules and files and package-lock.json

Then run following command to install dependencies:

Step 2: $ rm -rf node_modules package-lock.json && npm install && npm start

Finally, run your package by following command:

npm start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM