node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module 'C:\Users\user\desktop\dev-folder\node\node.js'
←[90m at Module._resolveFilename (node:internal/modules/cjs/loader:985:15)←[39m
←[90m at Module._load (node:internal/modules/cjs/loader:833:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m at node:internal/main/run_main_module:23:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
Node.js v18.10.0
PS C:\Users\user\desktop\dev-folder\node> node node -v
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module 'C:\Users\user\desktop\dev-folder\node\node'
←[90m at Module._resolveFilename (node:internal/modules/cjs/loader:985:15)←[39m
←[90m at Module._load (node:internal/modules/cjs/loader:833:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m at node:internal/main/run_main_module:23:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
Then i get this error,But if i run it on my CLi it works perfectly
i tried running it on my CLi it worked perfectly but when i run it on vs code integrated terminal it doesn't work
CodePudding user response:
is exactly path C:\Users\user\desktop\dev-folder\node\node
?
You can get path of file in vscode:
- Right click in file js need to run
- Click
Copy Path
- In vscode terminal, run
node {path_copied}
CodePudding user response:
Try the below command:
- go to the folder path in vs terminal
- run node <filename.js>