Related
Lately, I was trying to install NodeJs on my desktop PC and I ran into this weird problem. When I type, eg. node -v command, it returns nothing. After node I can add anything, it will just be ignored and won't return anything in the next line. I've added C:\Program Files\nodejs to PATH system variable, but it still doesn't work. Only time node -v command works is when I do (in cmd) C:\Program Files\nodejs>cd C:\Program Files\nodejs, then C:\Program Files\nodejs>node -v and in the next line it returns proper verision v16.13.1 .
Obviously, node command works and returns properly only when I run command from \nodejs folder, but as I saw on the Internet, it should work (with system PATH set up) from any folder. I think something is messed up in my Environment Variables, but if you know how to solve this problem, please let me know! Every comment is appreciated!
I downloaded NodeJs from https://nodejs.org/en/download/ (LTS, Windows Installer, 64-bit). Thanks in advance!
PS. npm command works correctly from any folder.
#Compo
Your issue is that you have many things in the %Path%, and clearly have made errors when adding for node.exe.
The first noted problem is that you have added C:\Program Files\nodejs\node.exe when you should have used only C:\Program Files\nodejs. Entries in this variable are for the directories which hold your executable files, not the files themselves. However, as C:\Program Files\nodejs is already included, you can simply remove that invalid entry.
The next issue, is that you need to understand what happens when you enter node in the Command Prompt or a batch file. What happens is that the current directory is searched for files named node which have an extension matching one listed in the %PATHEXT% value, (which is searched in order first to last). If a match is found, that file is run, and the searching stops. If no file is found, the same process occurs with every location listed under %Path%, (in its listing order first to last), the first matching file is run and the searching stops.
So by using node, what happens in your case is the %Path% is being searched, because there is no file named node.COM, node.EXE, node.BAT, node.CMD, node.VBS, node.VBE, node.JS, node.JSE, node.WSF, node.WSH, or node.MSC in the current directory. So each location is searched in order, until it reaches the first match, which in your case happens to be C:\xampp\htdocs\WebRulet\node.JS.
So essentially by using a presumptive/lazy command you are effectively running:
C:\xampp\htdocs\WebRulet\node.JS -v
Which is not what you wanted, and why you are not getting the result you had hoped for.
So now you understand the process which happens, by using code which make assumptions, and how that could cause issues, errors, or potential catastrophies. You should realize with all of that searching, especially if you have many entries in your %Path% and/or %PATHEXT% values, that the quickest and safest way to run your command would be:
"C:\Program Files\nodejs\node.exe" -v
Or
"%ProgramFiles%\nodejs\node.exe" -v
Please note that those absolute paths are double-quoted because they contain space characters. However, spaces are not the only problematic characters used in filenames, so best practice is, unless you are certain there are no such poison characters, to always double-quotes.
Now I know that almost every site will never explain all of that information, and all the code you read will not follow it either, so you are probably going to want to minimize your typing whilst working on the command line.
In order to do that, you will need to ensure that your %Path% value string, is ordered in such a way as your most frequently typed executable file path, is nearer the beginning, than any other location holding a possible matching file. However I will strongly suggest that you always use file extensions, for safety, (it is, after all, usually just four more characters to type).
Noting the entries in your %Path%, there are some extremely important ones missing, which means that your %Path% is essentially corrupted, and requires fixing because it will seriously affect the proper running of your Operating System.
To fix your variables, and order them correctly, begin by typing the following in your Command Prompt window:
Start %SystemRoot%\System32\SystemPropertiesAdvanced.exe
In the window which opens, click on the [Environment Variables] button. A new window will open, within the User variables (upper pane), double-click on Path, and using the [New] [Delete], [Move Up] and [Move Down] buttons make sure that the entries in it, in this order, are:
%UserProfile%\AppData\Roaming\npm
%UserProfile%\.dotnet\tools
%UserProfile%\AppData\Local\Microsoft\WindowsApps
%UserProfile%\AppData\Roaming\Composer\vendor\bin
D:\Inkscape\bin
Once done, click on [OK] to close the window, then do the same thing for System variables, (lower pane), with the following ordered list:
%SystemRoot%\System32
%SystemRoot%
%SystemRoot%\System32\wbem
%SystemRoot%\System32\WindowsPowerShell\v1.0
%SystemRoot%\System32\OpenSSH
%ProgramData%\ComposerSetup\bin
%ProgramData%\DockerDesktop\version-bin
%ProgramFiles%\Docker\Docker\resources\bin
%ProgramFiles%\Azure Data Studio\bin
%ProgramFiles%\nodejs
%ProgramFiles%\dotnet
%ProgramFiles%\heroku\bin
%ProgramFiles%\Oracle\VirtualBox
%ProgramFiles%\NVIDIA Corporation\NVIDIA NvDLISR
%ProgramFiles(x86)%\NVIDIA Corporation\PhysX\Common
%SystemDrive%\xampp\bin
%SystemDrive%\xampp\htdocs\WebRulet
Once complete click on [OK], [OK], and [OK] to close your windows, and then close the Command Prompt window.
From now on you should be able to open any new Command Prompt window and use:
node -v
But remember, I strongly advise that you get into the habit of using its extension:
node.exe -v
Which should result in:
v16.13.1
I am very new to Julia and wanted to use Sublime Text 3.
When I try to run the simplest code, something like this happens:
You can see that Julia is added to the path.
I constantly got zmq issue at the start of Sublime Text. I tweaked the windows part of IJulia settings to take care of the zmq error.
{
"zmq_shared_library": "C:/Users/reha/.julia/v0.5/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libzmq.dll",
"commands": [
{
"command_name": "default",
"julia": "julia.exe",
"julia_args": "",
"ijulia_kernel": "C:/Users/reha/.julia/v0.5/IJulia/src/kernel.jl"
}
]
However, Sublime keeps not building my .jl files. I have no issue with .py files. They work as they are supposed to. What is the problem here?
EDIT: It worked when I saved the file in the julia directory. For some reason, I failed to add Julia to the path, however you can see that it is in the path in the provided screenshot.
I found out that adding Julia to path is not enough to add Julia to path. The address of libzmq should also be added to the path.
Now Julia files work from any location.
I installed IJulia package for sublime. When I start sublime, I got ZMQ shared library not found....
I try to find ZMQ from Julia:
julia> using ZMQ
julia> println(ZMQ.zmq)
C:\Users\Nick\.julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libzmq.DLL
I open Package settings - IJulia - user, modified the path in this line:
"zmq_shared_library": "~/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libzmq.dll",
Restart sublime, I got this:
Unable to find an entry point ... libstdc++-6.dll
What's should I do?
Environment:
Windows 7, 64-bit
Julia v"0.3.8"
Sublime text 3
Update - kernel died
I found that there's an issue here:
https://github.com/quinnj/Sublime-IJulia/issues/64
To quote:
tildebyte commented on 28 Feb
Answering my own question: libstdc++-6.dll exists in 2 places: Sublime
Text 3 Beta\Data\Packages\IJulia\windeps and
.julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin.
i.e., the version shipping with the plugin doesn't match the one
libzmq is linked against. I fixed it by copying down ZMQ's libstdc DLL
from mingw\bin into the plugin's windeps dir. So, yes, I concur:
#M-Marz libzmq is probably mismatched to the plugin OR he's got
another libzmq somewhere in the path, which ST is finding first.
So I tried to copy the libstdc++-6.dll from .julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin to Sublime Text 3 Beta\Data\Packages\IJulia\windeps.
Sublime stops complain ZMQ library not found or cannot found entry point; however, when I try Ctrl-shift-p, open ijulia, I got ***kernel died***.
I searched my system, found that there's several libstdc++-6.dll for several individual applications: Julia, Evernote, VLC ...
How could I figure out what's wrong?
Update - "kernel died" Solved
I found the same problem here:
https://github.com/quinnj/Sublime-IJulia/issues/60
Thanks to #GregPlowman:
Finally, after much playing around, I managed to get Sublime-IJulia
working on Windows.
Seems some file paths are processed differently. (Maybe some by
Windows directly, others by Julia with some parsing?).
In any case, care needs to be taken with file paths on Windows:
absolute or relative
quoting entire pathname (especially important if path name has spaces)
path separators ( forward or back slash / vs \ )
I played around with many combinations and got really confused.
However I think the Julia executable path should be absolute, quoted
(if spaces in path name) and use backslashes. ZMQ and kernel pathnames
can be relative, should be unquoted, and use forward slash separator.
Here's the Windows extract from Sublime user settings file that worked
for me:
"windows": {
"zmq_shared_library": "~/.julia/v0.3/ZMQ/deps/usr/lib/libzmq.dll",
"commands": [
{
"command_name": "default",
"julia": "\"C:\Program Files\Julia-0.3.5\bin\julia.exe\"",
"julia_args": "",
"ijulia_kernel": "~/.julia/v0.3/IJulia/src/kernel.jl"
}
] }
Note that to quote path name use \", and to use backslash path
separator use \.
Cheers, Greg
Lesson learnt
When an opensourse software goes wrong, the first place to find solution is the issues from github. Thanks to #tidlebyte and #GregPlowman. (Both of them fired the issue, and found solution themselves.)
Brief answer:
Solution to ZMQ Library Not Found
Step 1:
(1) Copy everything from IJulia package settings - default to package settings - user.
(2) Find ZMQ lib path
julia> using ZMQ
julia> ZMQ.zmq
"C:\\Users\\Nick\\.julia\\v0.3\\WinRPM\\deps\\usr\\x86_64-w64-mingw32\\sys-root\\mingw\\bin\\libzmq.DLL"
(3) Modify the zmq_shared_library path according to (2).
Step 2: Copy libstdc++-6.dll from C:\\Users\\Nick\\.julia\\v0.3\\WinRPM\\deps\\usr\\x86_64-w64-mingw32\\sys-root\\mingw\\bin\\ to C:\Users\Nick\AppData\Roaming\Sublime Text 3\Packages\IJulia\windeps. (Yes, overwrite.)
Solution to Kernel Died
Modify the path in IJulia package settings - user
"windows": {
"zmq_shared_library": "C:/Users/Nick/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libzmq.DLL",
"commands": [
{
"command_name": "default",
// "julia": "julia-readline.exe",
"julia": "\"C:\\application\\Julia-0.3.8\\bin\\julia.exe\"",
"julia_args": "",
"ijulia_kernel": "~/.julia/v0.3/IJulia/src/kernel.jl"
}
]
}
Pay special attention to the quotes on path. Especially \" for quote the whole path.
Again, thanks to #tidlebyte and #GregPlowman for their early exploration and solution. If anybody got stuck on any of above steps, please let me know.
I have downloaded Cassandra community edition 2.1.2 (I know its a latest development release currently hence may not be stable). The reason being newer version of cassandra-stress tool which support YAML based configuration which enables to run the tool on my desired keyspace instead of the hardcoded "Keyspace1" in current stable version.
On Windows 7 machine when trying to run cassandra-stress via command line and specifying the path to YAML file, it is always giving error due to ":" character in path starting with "C:\"
C:\Program Files\DataStax Community\apache-cassandra\tools\bin>cassandra-stress user profile=../cqlstress-musicdb.yaml ops(insert=1)
The output is
Illegal character in path at index 10: file:///C:\Program Files\DataStax Community\apache-cassandra\tools\bin\cqlstress-musicdb.yaml
I tried different options to specify the path
giving absolute path
giving absolute path in double quotes as well as single quotes
copy YAML in the same folder and just specify the file name
copy YAML in a path without spaces because when using single quote space gives the problem
escaping ":" using backslash
ignoring "C:" from the beginning and directly starting abosolute path by "/"
tried different sample YAML file which comes with cassandra
As a next step, I am planning to download the source code and check whats going on there, or try this out on some linux machine if I am able to get hold of one in my org, but just thought to put this question is anyone could help.
Thanks.
I'm not sure what's going on there exactly, but it does seem like a bug that the new cassandra-stress has such trouble with that profile path on Windows.
I was able to make the following work:
First, copy your .yaml file to a path without spaces (like c:\temp)
Then, run the stress command using the "file:///" prefix, like the following
C:\>cd "Program Files\DataStax Community\apache-cassandra\tools"
C:\Program Files\DataStax Community\apache-cassandra\tools>bin\cassandra-stress user profile=file:///c:/temp/cqlstress-example.yaml ops(insert=1)
On Windows you may have an easier time if you install into a path like c:\cassandra rather than the default under Program Files. (Avoiding all those spaces in directory names.)
This issue is still is present in the 2.1.5 edition of Datastax Community Edition for Windows. The stack is installed under e:\cassandra and it still fails :-(. Note what is not documented is that you need to give full path using syntax like so:
file:///c:/temp/cqlstress-example.yaml
Another cruel hack is to set up a local apache server, place your yaml files there and use profile path to be served from the server like so
bin\cassandra-stress user profile=http://localhost/sample.yaml ops(insert=1)
After installing node.js then the Sublime-JSHint plugin on Windows XP with SublimeText3, I get the following error:
"Node.js was not found in the default path. Please specify the location."
This is a known configuration issue and is documented by the author, however I can't work out how to specify the path. Can anyone tell me how to specify the path in Windows XP?
https://github.com/victorporof/Sublime-JSHint#oh-noez-command-not-found
I have tried
"node_path": "/Program Files/nodejs",
"node_path": "C:/Program Files/nodejs",
"node_path": "/Program Files/nodejs/node.exe",
"node_path": "C:/Program Files/nodejs/node.exe",
This works for me:
"node_path": "C:/Program Files/nodejs/node.exe"
Try using
"node_path": "/c/Program Files/nodejs/node.exe"
and make sure this option is in your Packages/User/JSHint.sublime-settings file. I'm not sure why your last setting didn't work, because it is also in a valid format, but hopefully using the Cygwin-style path will work.
This finally worked for me:
"node_path": "\"C:/Program Files (x86)/nodejs/node.exe\"",
I'm on Windows 7, so node was installed in Program Files (x86). Just knock of the " (x86)" part for if node is installed in Program Files.
I basically had to start the cmd application in Windows and type in commands until I found one that spit out the Node help text:
"c:/Program Files (x86)/nodejs/node.exe" --help
I had to encase the file path in double quotes because the file path had space characters and parenthesis in it. The "node_path" config setting also needed the file path encased in double quotes, which had to be escaped.
I found an another issue that causes to show that error. Its on registry editor . HKEY_CURRENT_USER\Software\Microsoft\Command Processor here I set AutoRun key to load c:\profile.bat where I added sublime path run sublime from cmd. But when I open cmd its through error ( its actually done by powershell ). After deleting that key node.js path working just fine. Hope this will help someone.
I was having this issue with html-css-js.prettify. In the end none of these issues worked for me and I had to comment out line 58-62 of HTMLPrettify.py so that the only line left would look up the path with the line...
node = settings.get("node_path")
I restarted SublimeText and it started working.
I imagine a similar solution might work for JSHint.
I just change in the python script and asign my node path to node_path instead of get_node_path(). Or you can set get_node_path() to return C:\\DevTools\\nodejs\\node.exe
%APPDATA%\Sublime Text 2\Packages\HTML-CSS-JS Prettify\HTMLPrettify.py
line 81 def run_script_on_file(self, temp_file_path):
try:
node_path = "C:\\DevTools\\nodejs\\node.exe"
Well, you should
Ctrl + ` // or View => Show Console
to see what's wrong.
Mostly, it's not the Node.js path problem
For example, what I could see is
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcd in position 0: ordinal not in range(128)
So, I searched it, and solved it with:
// HTMLPrettify.py
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sublime, sublime_plugin
import os, sys, subprocess, codecs, webbrowser
reload(sys) # NEW LINE !!! <================
sys.setdefaultencoding("utf-8") # NEW LINE !!! <================
Well, after that, it's OK.
In my case this setting DOES NOT work
"node_path": "/usr/lib/nodejs/node-v6.11.0/bin/node",
but this WORKS
"node_path": { "linux" : "/usr/lib/nodejs/node-v6.11.0/bin/node" }
This change has to be made in the JSHint.sublime-settings file.
Hope this helps! Although changes are effective right away, I would try restarting the Sublime after the change to make sure if this resolves your problem.
What worked for me:
I searched 'node.exe' in both program files and program files(x86).
Then I got a file named node.exe in some folder I copied its path and pasted like this
/path/node.exe
Note: you have to change \ to /