简体   繁体   中英

How to run node in VSCode properly?

$ node test.js
internal/modules/cjs/loader.js:883
  throw err;
  ^

I tried all the ways (adding/checking PATH route for node js, restarting, using another files etc) and couldn't find why my node doesn't run properly. When I'm typing node -v it returns me version, so it is installed, I go to VSCode and open my any folder. Then in JS file when I'm typing for instance node app.js it throws me error that I wrote above. Any idea what should I try else?

Seems like node modules are not properly installed. Try these steps and let me know:

  • delete node_modules
  • delete package-lock.json file
  • npm install
  • npm start

should be good to go.

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