Visual Studio Code Removing Items from System Path? - windows

I am opening a project in Visual Studio Code and it can't find npm, in spite of NPM being in my system path.
If I open a command prompt or a powershell prompt, and I type env I See it in my path. If I open a terminal in VS:Code and type env it omits both: /d/nodejs and /c/Program Files/Azure Data Studio/bin from the list of items in my path.
I have tried rearranging all of my paths in my Windows Environment Variable editor dialog, and no matter the order, only these two items are missing. So, I have validated that it is not other paths that could be causing issues in some sort of path parsing code.
Why would Visual Studio Code alter my path environment variable, removing node and its own path from the environment variable list?
If I move these items from my system path to my user path, it is able to find them but there are some other subtle issues with things not being found I haven't been able to figure out yet.
Note: These are the ONLY two items being removed. And they are ONLY removed in VS:Code.

Even though there is other weirdness with moving the path to my user path from my system path, that was able to be worked around. So, my answer is: Move your nodejs path from your system path in Windows to your user path in Windows.

Related

Dart-Sass not being added to PATH

So, I've downloaded the .zip 1.32.11 Windows x64 release from the Dart-Sass's Github repo and extracted it to the Program Files folder. Using the steps provided, I found Path under System variables in Step 4. There was no PATH there, the closest thing was PATHTEXT and Path. My first question: Can I use Path or I have to create a new System variable called PATH. Thinking Path was sufficient, I decided to edit the System variable and then press Browse to search for the Dart-Sass folder. After this was done, I went to Command Prompt and typed sass -version. The result was that Sass was not recognized. Did I do anything wrong? If so, what can I do to fix it?
I'm noticing two things about your problem. The first is your path variable... did you make sure to change Me to your username in the PATH variable?. The second encompasses your installation. Can you find the dart *.exe file? If not, try uninstalling and reinstalling, making sure each step is completed word for word.

Set proper paths for VS Command Line Compiler

I recently installed vs15 - preview (Stripped down version of visual studio 2015).
I am able to compile C/C++ sources from inside the IDE, but I am not able to compile with the command line interface cl.exe. It can't find the c stdlib headers. I tried to use vcvars32.bat to set the proper reg values but seemingly it cant find the "Common Tools Folder".
"ERROR: Cannot determine the location of the VS Common Tools folder."
The script uses the env. variable "%VS150COMNTOOLS%".
If I try to run "cd %VS150COMNTOOLS%" from the cmd line, it can't find the path, so this seems to be the main problem.
How can manually set %VS150COMNTOOLS% to the right path? how can I set the cmd linker settings manually (Without telling the cl.exe every time I call it)?
Okay, I solved it by adding the path to the include directories and lib directories to the env. variables as "INCLUDE", "LIB". It works now, whyever the script was not able to set those values properly. I am not fluent in reading .bat let away writing in, I assume the directory structure, which is different for the vs15 preview when compared to the full version, had not been adapted yet.

The term 'node' is not recognized... In Powershell

I have been trying to resolve this issue for the whole day.
When I run node -v or npm install in cmd prompt, it works absolutely fine. But when I run the same commands in Powershell, it gives the following error:s
PS C:\Users\Anubhav.Trivedi> node -v
The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
ng of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ node <<<< -v
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I tried uninstalling node js and reinstalling it. Added node js path C:\Program Files (x86)\nodejs\ to enviroment variables (system variables). Restarting computer. But nothing seems to work.
Kindly let me know, what am I missing here.
These issues cannot be installed from the Package Manager console, so I had to browse lot of things to fix the issues and finally I got the solution.
Maybe we followed these scenarios
Missing Node.js software
Wrongly updated Windows environment path
Installed in the wrong path
Old version of Node.js software
You can download the latest Node.js software here.
Update Path
After installation, automatically create nodejs folder in this path “C:\Program Files (x86)” or “C:\Program Files “.
Open Control Panel -> User Accounts -> Change my environmental variable and verify the path Variable value “C:\Program Files (x86)\nodejs” or “C:\Program Files\nodejs “.
new => user = path => value = C:\Program Files (x86)\nodejs and after apply that.
and close Editor and restart it. it will work correctly.
note :- enter your path instead of copy of this path.
As dan-gph mentioned check the Path in environment variable using script $env:path -split ';' | Select-String nodejs and once you update the Path in environment variable, make sure to restart powershell and also restart explorer.exe. This would resolve the issue.
If you still face issues, check which nodejs you have installed (32bit or 64bit). Install 32 bit only as powershell or cmd are 32bit programs
Model for VSCode editor
C:\Program Files\nodejs
C:\Program Files\nodejs\node_modules\npm\bin
Search PATH environment variable.
Add the above paths into the Environment variables (both user
variable path and system variable path).
Restart VSCode.
Open a new terminal in VSCode
run node --version output should equal v16.13.0
If you installed NodeJs recently after opening the IDE like Visual Studio Code or any other IDE that includes the terminal you are trying. then try this.
Restart the IDE, If you installed NodeJs recently after opening the IDE like Visual Studio Code or any other IDE that includes the terminal you are trying.
Restart the CommandLine if you installed NodeJs after you opened the CommandLine.
I hope it will be fixed most of the time by following these simple steps.
Happy Coding!
open control panel then--
user accounts
|
user accounts
|
change my environment variables
|
new
|
(In variable name use)--Path
|
(In variable value use)C:\Program Files\nodejs
|
ok
After that just restart you terminal
chances are that you messed up with your system path, if it's the case, a very straight forward solution will be re-installing node and npm but don't forget to close and re-open powershell/cmd
Note: i thought that restarting computer has no effect on path but in an accident someone just deplug my laptop from power and after i turned it on everything was repaired and OK!
Reinstall/repair the application and close the vs code powershell
I've got the same error. Simply check below instructions. If all they are done. Just restart your computer. Then it will worked for me. I just restarted my computer.
List item
Missing Node.js software
Wrongly updated Windows environment path
Installed in the wrong path
1.find nodejs folder
go to environment variable in windows
edit path and add "find nodejs folder"
Restart computer
This issue corrected after updated my environment variable path
i just copy the path from path value in user to path value in system check image attachment.
https://i.stack.imgur.com/11uCk.png
path change image below
Go to Control Panel\System and Security\System on Windows 10.
Go to advance properties.
Advance system settings -> advance system settings -> Environment Variables Or type edit the system environment variables in the windows search.
Add "C:\Program Files\nodejs" ,"C:\Program Files\nodejs" and "C:\Program Files\nodejs\node_modules\npm\bin" to the user and system variable (path)
restart the cmd and run again.
Hope it will work.

Don't get GraphViz and phpDocumentor to work

I'm trying to create a php documentation on my local XAMPP host (on Windows 7) with phpDocumentor.phar (v2.). It gives me (after parsing all the files) this error:
Unable to find the dot command of the GraphViz package. Is GraphViz correctly installed and present in your path?
I searched a lot, but nothing helps. What does 'path' means? If I open a command box at any location I can start the dot.exe (which gives me no output but waiting prompt). In my environment path variable the bin folders is added. GraphViz is installed correct in Program Files and runs standalone.
What could I do or check?
In order to get GraphViz running properly with a Windows based phpdoc installation, just put the GraphViz program directory (c:\some\path\graphviz\release\bin) to the Windows Path system variable.
In order to do this, follow these steps (Win7, please provide your OS version if this doesn't apply to your situation):
From the desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button.
Different directories are separated with a semicolon:
C:\Program Files;C:\Winnt;C:\Winnt\System32
It will most likely look a bit different in your enviroment, so please just take this for an example. Just add the GraphViz Path at the end like this:
C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\somefolder\graphviz\release\bin
I'm not too sure if you have to reboot your system after changing this value. You had to do this in the old days of Win2k, and I just don't know if this still applies to modern Windows versions. It surely doesn't hurt!
After this, phpdoc should be able to find the dot command.
The steps to resolve this error are:
download Windows Packages from
https://graphviz.gitlab.io/_pages/Download/Download_windows.html
Just install it
add c:\Program Files\Graphviz*\dot.exe or c:\Program Files (x86)\Graphviz*\dot.exe to your environment variable PATH
run phpdoc
Re-start your machine & run phpdoc (if still shows the same error message)

Problems installing Python 27 on Windows 7 - cannot add Python to PYTHON PATH

I installed Python 2.7.3 on my Windows 7 computer using the binary, the first link. After installing it, IDLE works but nothing else recognizes Python. For example, typing python at the command prompt returns the message "'Python is not recognized as an internal or external command, operable program or bath file."
Following this post, I made sure that python 2.7 was in the PYTHONPATH environment variable. However, that didn't help.
What should I do?
PYTHONPATH system variable is used by Python itself to find directories with installed packages.
PATH system variable is used by OS (particularly Windows) to find executables which can open certain files like *.py scripts.
So, you need to add directory with python.exe (for example C:\Python27) to PATH system (or user) variable and not to PYTHONPATH. It can be done the same way as described in the link you've found in the same tool window.
For example on my machine PATH system variable is set to C:\Python27;C:\MinGW\bin;...
Like Vladimir commented, for setting up python in windows, you need to add the directory where your python.exe is located (for example C:\Python27) to PATH
You can confirm if python is in your environment variables by looking at the output of echo %path%
Keep in mind that after editing the PATH variable using the control panel, you have to open a new terminal, as the setting will NOT be updated in existing terminals.
Another possibility is that you added the wrong path to the PATH variable. Verify it.
The bottom line is, if the directory of your python.exe is really in PATH, then running python will really work.
Here are your steps:
Right-click Computer and select Properties.
In the dialog box, select Advanced System Settings.
In the next dialog, select Environment Variables. In the User Variables section, edit the PATH statement to include this:
C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
Now, you can open a command prompt (Start Menu|Accessories or Start Menu|Run|cmd) and type:
C:\> python
That will load the Python interpreter!
You can install for single user rather than choosing the option of "Install for all users". I was facing the same issue, but when I tried installing just for myself, I was able to install successfully.

Resources