What file is node debugger breaking in? - node.js

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

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

Node Module Path Execution Windows 10

$ 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!

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?

Lua: error loading module file not found

I'm trying to set up Lighttpd + lua + fastcgi to run web interface on an embedded MIPS board. But the important part here, I guess is Lua.
When trying to run /usr/local/bin/wsapi.fcgi (which is lua script) I get this error:
/usr/bin/lua: error loading module 'lfcgi' from file '/usr/local/lib/lua/5.1/lfcgi.so':
File not found
stack traceback:
[C]: ?
[C]: in function 'require'
/usr/local/share/lua/5.1/wsapi/fastcgi.lua:9: in main chunk
[C]: in function 'require'
/usr/local/bin/wsapi.fcgi:9: in main chunk
[C]: ?
Which is really strange, because ls shows that file is there and all permissions are ok:
# ls -l /usr/local/lib/lua/5.1/lfcgi.so
-rwxr-xr-x 1 0 0 21152 /usr/local/lib/lua/5.1/lfcgi.so
And which is more frustrating, if I actually remove the file, lua shows a different error, which means that first error wasn't really caused by lua unable to locate file properly.
So I'm a bit lost here, looks like the error message is misleading and problem isn't really the file being not found, but what...
P.S. The error comes from file wsapi/fastcgi.lua, from line 9 which looks like this:
local lfcgi = require"lfcgi"
- maybe there is something wrong with require syntax? I'm no expert in lua so I can't tell.
Ok, I figured it out. It turned out to be a missing dependency, as #Ctx suggested.
readelf -d lfcgi.so | grep NEEDED
shows that it needs libfcgi.so.0 which is a symlink to libfcgi.so and I only have the last one, not the symlink.
After creating the symlink it is working now (actually it comes with another error, but it is a different story :P).
By the way - the error message is really confusing - it looks like the file lfcgi.so is missing, when in fact it is one of its dependencies that is causing the problem.

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

Resources