简体   繁体   中英

Error in VSCode returning exit code 1 when running console.log("Hello world"); in javascript

I was trying to run my.js file in VSCode. But for some reason this line:

console.log("Hello world!");

returns:

[Running] node "c:\Users\ukkis\OneDrive\Рабочий стол\My_code\JS\test.js"
"node" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.

[Done] exited with code=1 in 0.084 seconds

what happened?

It seems like you haven't installed nodejs Runtime JavaScript Engine. To install:

  • For Windows download and install from official website https://nodejs.org
  • For Linux: sudo apt update and sudo apt install nodejs

Try by writing node and then file name in the cmd panel. here is the reference img.

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