8

I am new to javaScript, trying to set up Visual Studio Code. I have installed NodeJs and Visual Studio Code, with windows Powershell.

In visual studio > terminal if I run npm view command I am getting following error

CMD .EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
npm ERR! Invalid package

Can anyone please take a look at this issue. Is this because of restrictions on corporate systems?

1

2 Answers 2

12

It looks like your project directory (and your profile) is stored on a network fileshare, which is quite common in corporate environments.

You can ask your IT to create a mapped drive with your profile, or you can use the pushd command to create a temporary mapping.

  1. Before opening the project in Visual studio run this from your command line (replace the path with your actual UNC path):

    pushd \\corpserver\share$\jdoe\projects\java\...

    the command will place you in the newly created temporary drive.

  2. Copy the new temporary path

  3. Open Visual Studio Code and open your project from this temporary path

  4. You should now be able to use terminal and build/run scripts

12

In my case, I forgot to install NodeJS in WSL. Then, node was taken from Windows.

> which node
/mnt/c/Program Files/nodejs/node.exe

Installing NodeJS on my WSL did the trick

> sudo apt-get install nodejs
1
  • 1
    I wish I understood why this is it... nvm use Iron -> "Iron is not yet installed" nvm i Iron -> "v20 is already installed, now using v20" suddenly everything works, UNC error gone forever. Commented Mar 25 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.