LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2023, 12:16 PM   #1
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Rep: Reputation: Disabled
How To Set Node.js Extension PATH in VS Code


Hi Folks,

I installed on a Slackware based (SALIX) VS Code via FlatPack and I tried to set up the JAVA environment. First time I tested a JavaScript sample file received a message (see attached).

Then I installed from package manager nodejs 17.9.0 and I
Code:
export PATH=$PATH:/usr/bin/node
Then I tried to add node.js extension.
I followed:
https://code.visualstudio.com/docs/n...ith-javascript

I tried to add to launch.json "runtimeExecutable": "node"

Code:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}/GettingStarted/jssample.js",
            "runtimeExecutable": "/usr/bin/node"
        }
    ]
}

but still got the same message.



Code:
brad@toshiba:~$ java -version
java version "19.0.1" 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
brad@toshiba:~$ npm version
{
  npm: '8.5.5',
  node: '17.9.0',
  v8: '9.6.180.15-node.16',
  uv: '1.43.0',
  zlib: '1.2.12',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '102',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '3.0.2+quic',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0',m 
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
Tried to install 19.3.0:

I can run the js file from CLI BUT not in VS Code environment.
Not to mention it works just fine on Debian based OSs.


Thanks!
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2023-01-02_18-22-52.png
Views:	22
Size:	30.2 KB
ID:	40156  

Last edited by lattimro; 01-05-2023 at 10:12 AM.
 
Old 01-04-2023, 01:04 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
If the setup works fine in Debian, then one option is to set up a Debian Docker to develop in.

Last edited by dugan; 01-04-2023 at 01:09 PM.
 
Old 01-04-2023, 01:45 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
How is Java related to this problem?
Anyways, run this command, and insert here the result:
Code:
find / -name node -type f 2>/dev/null

Last edited by NevemTeve; 01-04-2023 at 01:52 PM.
 
Old 01-04-2023, 02:17 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Quote:
Originally Posted by lattimro View Post
Then I installed from package manager nodejs 17.9.0 and I
Code:
export PATH=$PATH:/usr/bin/node
I think what NevemTeve is getting at is that Node might actually not be in your PATH. Your top post certainly has no evidence of you having confirmed that. Are you sure the above (which looks extremely strange) is right? If you think it is, then can you link to who it was who told you to do it?

Last edited by dugan; 01-04-2023 at 02:40 PM.
 
Old 01-04-2023, 03:22 PM   #5
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
I think what NevemTeve is getting at is that Node might actually not be in your PATH. Your top post certainly has no evidence of you having confirmed that. Are you sure the above (which looks extremely strange) is right? If you think it is, then can you link to who it was who told you to do it?
what is strange?

who told you to do it?
To do what?
 
Old 01-04-2023, 04:36 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
No, I’ll just be more direct.

What does “which node” print out?
 
Old 01-04-2023, 04:45 PM   #7
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
No, I’ll just be more direct.

What does “which node” print out?
does
Code:
npm version
I posted above mean anything?
 
Old 01-04-2023, 05:08 PM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Honestly, I didn’t see it because I didn’t read past the Java noise. It looks good.

VSCode has its own terminal. What do you see when you do that (“npm version”) from VSCode’s terminal? The one you can start from its Terminal menu.
 
Old 01-04-2023, 06:53 PM   #9
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
Honestly, I didn’t see it because I didn’t read past the Java noise. It looks good.

VSCode has its own terminal. What do you see when you do that (“npm version”) from VSCode’s terminal? The one you can start from its Terminal menu.
I see, thanks for the tips, unfortunately I can't ssh right now (magic does not work now), but for sure it will not see node. I need to let VSCode to know where node is and so far I can't find where to set the PATH.

later ...
just to confirm VSCode can't see outside its environment, which was predictible

Last edited by lattimro; 01-05-2023 at 09:38 AM.
 
Old 01-05-2023, 09:20 AM   #10
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
How is Java related to this problem?
Anyways, run this command, and insert here the result:
Code:
find / -name node -type f 2>/dev/null
#7 means anything? I posted anyway:

Code:
/home/brad/Downloads/NODE.js/node-v18.12.1/out/Release/node
/home/brad/Downloads/NODE.js/node-v18.12.1-linux-x64/bin/node
/usr/bin/node
/proc/irq/0/node
/proc/irq/1/node
/proc/irq/2/node
/proc/irq/3/node
/proc/irq/4/node
/proc/irq/5/node
/proc/irq/6/node
/proc/irq/7/node
/proc/irq/8/node
/proc/irq/9/node
/proc/irq/10/node
/proc/irq/11/node
/proc/irq/12/node
/proc/irq/13/node
/proc/irq/14/node
/proc/irq/15/node
/proc/irq/16/node
/proc/irq/17/node
/proc/irq/19/node
/proc/irq/21/node
/proc/irq/23/node
/proc/irq/24/node
/proc/irq/25/node
/proc/irq/26/node
/proc/irq/27/node
/tmp/SBo/package-nodejs/usr/bin/node
/tmp/SBo/node-v19.3.0/out/Release/node

Last edited by lattimro; 01-05-2023 at 09:22 AM.
 
1 members found this post helpful.
Old 01-05-2023, 10:52 AM   #11
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
/proc/ and /tmp/ shouldn't be important, examine the first three:
Code:
ls -ld /home/brad/Downloads/NODE.js/node-v18.12.1/out/Release/node \
/home/brad/Downloads/NODE.js/node-v18.12.1-linux-x64/bin/node \
/usr/bin/node

file /home/brad/Downloads/NODE.js/node-v18.12.1/out/Release/node \
/home/brad/Downloads/NODE.js/node-v18.12.1-linux-x64/bin/node \
/usr/bin/node

Last edited by NevemTeve; 01-05-2023 at 10:53 AM.
 
Old 01-05-2023, 02:10 PM   #12
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
/proc/ and /tmp/ shouldn't be important, examine the first three:
Code:
ls -ld /home/brad/Downloads/NODE.js/node-v18.12.1/out/Release/node \
/home/brad/Downloads/NODE.js/node-v18.12.1-linux-x64/bin/node \
/usr/bin/node

file /home/brad/Downloads/NODE.js/node-v18.12.1/out/Release/node \
/home/brad/Downloads/NODE.js/node-v18.12.1-linux-x64/bin/node \
/usr/bin/node
I do not know what you want to get? It not about machi but VSCode not seeing node.js

first 2 in ~ are packages
the third:
Code:
root[brad]# ls -ld /usr/bin/node
-rwxr-xr-x 1 root root 72651768 May 27  2022 /usr/bin/node
root[brad]# file /usr/bin/node
/usr/bin/node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped
 
Old 01-05-2023, 03:54 PM   #13
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Could you please explain this error message:
Can't find Node.js binary "node": path does not exist.
What path doesn't exist?
 
Old 01-05-2023, 05:17 PM   #14
lattimro
Member
 
Registered: Jul 2021
Distribution: SOLARIS/BSD-like, some Debian-like, some Arch-like, some GENTO-like, some RH-like, some slacky-like
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
Could you please explain this error message:
Can't find Node.js binary "node": path does not exist.

What path doesn't exist?
That's the existential question, I'm glad you understand. If VS Code had found node.js, the OP wouldn't be here.

I assumed the PATH to node. The VS Code container can't communicate with the "node" on the machine.

I also tried almost all VSCode "node" extensions packages even they say:

Quote:
Visual Studio Code has support for the JavaScript and TypeScript languages out-of-the-box as well as Node.js debugging. However, to run a Node.js application, you will need to install the Node.js runtime on your machine.

To get started in this walkthrough, install Node.js for your platform. The Node Package Manager is included in the Node.js distribution. You'll need to open a new terminal (command prompt) for the node and npm command-line tools to be on your PATH.

To test that you have Node.js installed correctly on your computer, open a new terminal and type node --version and you should see the current Node.js version installed.
"You'll need to open a new terminal (command prompt) for the node and npm command-line tools to be on your PATH." What does mean?

Last edited by lattimro; 01-06-2023 at 04:44 AM.
 
Old 01-06-2023, 12:31 AM   #15
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
It might have a point: please quote the output of command /usr/bin/node --version
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rhel 2 node cluster: resources do not move to second node when node halted tapuhi Linux - Software 1 03-01-2015 10:41 AM
node recovery when the node becomes fault by using another node to replace it jerinc Linux - Wireless Networking 0 02-21-2014 05:44 PM
How to transfer the services from node 1 to node 2 ,if node 1 is directly turned off sankarg304 Linux - Server 1 12-12-2012 10:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration