Node Module Path Execution Windows 10 - node.js

$ npm install -g static-server
C:\Users\Stuart's\AppData\Roaming\npm\static-server -> C:\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js
+ static-server#2.2.1
added 13 packages from 6 contributors in 1.238s
Stuart's#Stuarts-PC MINGW64 ~/Documents/GitHub/PIES-Network/dapp (master)
$ static-server
module.js:549
throw err;
^
Error: Cannot find module 'C:\c\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
clearly "C:\c\User.." is not a correct path to my node modules directory. I have checked my local paths and everything looks fine. Any help is appreciated Thanks

This looks a lot like you have accidentally created a directory called C:\c\Users\Stuart's\AppData\Roaming\npm wherein is located the file static-server.cmd. You have a path variable pointing there also somehow.
When static-server is invoked control is passed to the static-server.cmd batch file at this incorrect location.
node 'C:\c\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js
But static-server.js is located as per your install at:
C:\Users\Stuart's\AppData\Roaming\npm\node_modules\static-server\bin\static-server.js.
In these circumstances you will get exactly the errors shown.
It could be some variation on this and I am happy to help further, but step 1 is to check above because for sure the incorrect path parameter is being passed to node (which of course load and executes static-server.js).
EDIT: Here are some further tests:
Search for all instances of "static-server" on your hard disc.
Trying to do this with Explorer will take a long time.
The best and fastest way is to download a tool called UltraSeach.
Here are the search results from my PC ( I created the extra C:\c directory for test purposes).
Check for multiple versions of static-server.cmd or other executable file of that name.
Using a text editor (like notepad) open each static-server.cmd file and add these ECHO commands at the top
(ie before the line staret with #IF EXIST "%~dp0\node.exe" (
ECHO "File 1 executing"
ECHO "%~dp0"
PAUSE
If more than one version put "File 2", "File 3" etc.
Now type static-server at a command prompt and it should
Echo the message "File n executing"
Echo the directory it is executing from
Wait for you to press a key to continue.....
Note the directory it is executing from (call it \CURRENT say)
You can see from static-server.cmd that it then starts node
and tried to execute \CURRENT\node_modules\static-server\bin\static-server.js
In your case its not finding static-server.js where node expects to find it.
Look back to search results in step 1 and see where static-server.js is actually located.
Compare this to where node expects to find it in step 5.
Your problem is either that:
The static-server.cmd being executed is located in the wrong place OR
static-server.js is located at the wrong place.
Here is an additional test. Open a command window and navigate to the directory which has static-server.js. As per the screen-shot it is at C:\Users\Brendan\AppData\Roaming\npm\node_modules\static-server\bin in my case.
Then type node static-server.js. This bypasses the static-server.cmd file altogether, and should start the server. Worked in my case.
Let me know how you go!

Related

Sybase 16 startserver failed due to missing libsapcrypto.so

We've installed Sybase 16 Express in our Linux box, it was able to startup right after the installation. When we recently try restarting it with the startserver -f RUN_FILE command, it failed to find the libsapcrypto.so file.
~/sap/ASE-16_0/bin> ../sap/ASE-16_0/bin/dataserver: error while loading shared libraries: libsapcrypto.so: cannot open shared object file: No such file or directory
We searched this file, multiple matches presented in the following paths:
./DM/OCS-16_0/lib3p/libsapcrypto.so
./DM/OCS-16_0/lib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p/libsapcrypto.so
./DM/REP-16_0/lib64/libsapcrypto.so
./DataAccess/ODBC/lib/libsapcrypto.so
./DataAccess64/ODBC/lib/libsapcrypto.so
./OCS-16_0/lib3p/libsapcrypto.so
./OCS-16_0/lib3p64/libsapcrypto.so
./OCS-16_0/devlib3p64/libsapcrypto.so
./OCS-16_0/devlib3p/libsapcrypto.so
Since this hasn't been answered yet, running this command worked for me:
. /opt/sap/SYBASE.sh
Note the different syntax to make sure the environment variables are set in the terminal session, as opposed to using this syntax:
/opt/sap/SYBASE.sh

Win10: ASDF can't load system (ASDF_OUTPUT_TRANSLATION error)

Update 2
I think #faré is right, it's an output translation problem.
So I declared the evironment variable ASDF_OUTPUT_TRANSLATIONS and set it to E:/. Now (asdf:require-system "my-system") yields a different error: Uneven number of components in source to destination mapping: "E:/" which led me to this SO-topic.
Unfortunately, his solution doesn't work for me. So I tried the other answer and set ASDF_OUTPUT_TRANSLATIONS to (:output-translations (t "E:/")). Now I get yet another error:
Invalid source registry (:OUTPUT-TRANSLATIONS (T "E:/")).
One and only one of
:INHERIT-CONFIGURATION or
:IGNORE-INHERITED-CONFIGURATION
is required.
(will be skipped)
Original Posting
I have a simple system definition but can't get ASDF to load it.
(asdf-version 3.1.5, sbcl 1.3.12 (upgraded to 1.3.18 AMD64), slime 2.19, Windows 10)
What I have tried so far
Following the ASDF manual: "4.1 Configuring ASDF to find your systems"
There it says:
For Windows users, and starting with ASDF 3.1.5, start from your
%LOCALAPPDATA%, which is usually ~/AppData/Local/ (but you can ask in
a CMD.EXE terminal echo %LOCALAPPDATA% to make sure) and underneath
create a subpath config/common-lisp/source-registry.conf.d/
That's exactly what I did:
Echoing %LOCALAPPDATA% which evaluates to C:\Users\my-username\AppData\Local
Underneath I created the subfolders config\common-lisp\source-registry.conf.d\ (In total: C:\Users\my-username\AppData\Local\config\common-lisp\source-registry.conf.d\
The manual continues:
there create a file with any name of your choice but with the type conf, for instance 50-luser-lisp.conf; in this file, add the following line to tell ASDF to recursively scan all the subdirectories under /home/luser/lisp/ for .asd files: (:tree "/home/luser/lisp/")
That’s enough. You may replace /home/luser/lisp/ by wherever you want to install your source code.
In the source-registry.conf.d folder I created the file my.conf and put in it (:tree "C:/Users/my-username/my-systems/"). This folder contains a my-system.asd.
And here comes the weird part:
If I now type (asdf:require-system "my-system") in the REPL I get the following error:
Can't create directory C:\Users\my-username\AppData\Local\common-lisp\sbcl-1.3.12-win-x86\C\Users\my-username\my-systems\C:\
So the problem is not that ASDF doesn't find the file, it does -- but (whatever the reason) it tries to create a really weird subfolder hierarchy which ultimately fails because at the end it tries to create the folder C: but Windows doesn't allow foldernames containing a colon.
Another approach: (push path asdf:*central-registry*)
If I try
> (push #P"C:/Users/my-username/my-systems/" asdf:*central-registry*)
(#P"C:/Users/my-username/my-systems/"
#P"C:/Users/my-username/AppData/Roaming/quicklisp/quicklisp/")
> (asdf:require-system "my-system")
I get the exact same error.
I don't know what to do.
Update
Because of the nature of the weird path ASDF was trying to create I thought maybe I could bypass the problem by specifying a relative path instead of an absolute one.
So I tried
  (:tree "\\Users\\my-username\\my-systems")
in my conf file. Still the same error.
Ahem. It looks like an output-translations problem.
I don't have a Windows machine right now, but this all used to work last time I tried.
Can you setup some ad hoc output-translations for now that will make it work?

How to create a JSCS config file on windows

When I try to create a JSCS config file:
C:\Blog\BlogWeb>jscs --auto-configure "C:\Blog\BlogWeb\temp.jscs"
I get the following error:
safeContextKeyword option requires string or array value
What parameter am I supposed to pass? What is a safecontextkeyword?
New to NPM and JSCS, please excuse ignorance.
JSCS was complaining that I didn't have a config file, so I was trying to figure out how to create one.
JSCS looks for a config file in these places, unless you manually specify it with the --config option:
jscs it will consequentially search for jscsConfig option in package.json file then for .jscsrc (which is a just JSON with comments) and .jscs.json files in the current working directory then in nearest ancestor until it hits the system root.
I fixed this by:
Create a new file named .jscsrc. Windows Explorer may not let you do this, so may need to use the command line.
Copy the following into it. It doesn't matter if this is the preset you want to use or not. The command will overwrite it.
{
"preset": "jquery",
"requireCurlyBraces": null // or false
}
Verify that it works by running a command such as:
run the command
jscs --auto-configure .jscsrc

What file is node debugger breaking in?

I have some code which I am running in debug mode. As I understand it, this runs it through the standard node.js debugger.
I'm frequently getting the following:
...
break in timers.js:77
...
Sometimes I have breakpoints at other files, but they always give absolute file paths, but in this case its just the file name. I cannot find a file with that name which has the content listed on line 77, nor can I find an explanation of how the debugger works in regards to this.
How can I find this timers.js file?
Generally, when you see filenames with no path in the debugger, it means that the file is one of the core libraries that are compiled in to the node binary.
If you want to dig in to source, make sure you're looking at the git tag that matches the version of node you're running.
The builtin files are:
assert.js
buffer.js
child_process.js
cluster.js
console.js
constants.js
crypto.js
dgram.js
dns.js
domain.js
events.js
freelist.js
fs.js
http.js
https.js
module.js
net.js
os.js
path.js
punycode.js
querystring.js
readline.js
repl.js
smalloc.js
stream.js
string_decoder.js
sys.js
timers.js
tls.js
tty.js
url.js
util.js
vm.js
zlib.js

LUAROCKS on windows installs rocks oddly

On Linux, luarocks installs rocks to
/usr/local/lib/luarocks/rock
and puts a corresponding lua file into
/usr/local/share/lua/5.3
On Windows(LUA 5.1), the rocks are in:
C:\Program Files (x86)\LuaRocks\systree\lib\luarocks
and the lua files are in:
C:\Program Files (x86)\LuaRocks\systree\share\lua\5.1
but lua cannot find them on the windows install.
I must have a PATH problem
This is some of my PATH:
Path=C:\Program Files (x86)\Lua\5.1\lua\;C:\Program Files (x86)\LuaRocks\2.2;C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks;C:\Program Files (x86)\LuaRocks\systree\bin;C:\Perl64\site\bin;C:\UnxUpdts;C:\Perl64\bin;C:\Program Files (x86)\Lua\5.1;C:\Program Files (x86)\Lua\5.1\clibs
I am trying ZeroBraneStudio as the IDE and my system prefs specify this path
path.lua = 'C:\Program Files (x86)\Lua\5.1'
I ran
luarocks install inspect
and that generated the necessary files. Then I wrote this simple test code:
require "inspect"
assert(inspect(1) == "1")
assert(inspect("Hello") == '"Hello"')
and got this error
Program starting as '"E:\Anonamouse\ZeroBraneStudio\bin\lua.exe" -e "io.stdout:setvbuf('no')" "E:\Anonamouse\ZeroBraneStudio\myprograms\DemoInspectModule.lua"'.
Program 'lua.exe' started in 'E:\Anonamouse\ZeroBraneStudio\myprograms' (pid: 14776).
E:\Anonamouse\ZeroBraneStudio\bin\lua.exe: ...namouse\ZeroBraneStudio\myprograms\DemoInspectModule.lua:2: attempt to call global 'inspect' (a nil value)
stack traceback:
...namouse\ZeroBraneStudio\myprograms\DemoInspectModule.lua:2: in main chunk
[C]: at 0x00402a57
Program completed in 0.04 seconds (pid: 14776).
I get the same error when I execute the same simple app directly in the console.(That tells me that PATH variable for lua is working)
What am I missing?
Judging from the error message you quoted the require "inspect" worked just fine, but the module didn't set a global variable inspect. For some time now it has been policy to not set globals from within modules, but instead return something (usually the module table) from the module code, which in turn gets passed down via require. So probably something like
local inspect = require "inspect"
assert(inspect(1) == "1")
assert(inspect("Hello") == '"Hello"')
or
local inspect = require "inspect"
assert(inspect.inspect(1) == "1")
assert(inspect.inspect("Hello") == '"Hello"')
should work.

Resources