package node with pkg ERR_INSPECTOR_NOT_AVAILABLE at run time - node.js

I am playing with pkg to package a command line example I got from a blog post. The executable created fine but when I try to run the executable, I am getting the following error:
pkg/prelude/bootstrap.js:1244
throw error;
^
Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available
at inspector.js:24:9
at NativeModule.compileForInternalLoader (internal/bootstrap/loaders.js:276:7)
at NativeModule.compileForPublicLoader (internal/bootstrap/loaders.js:218:10)
at loadNativeModule (internal/modules/cjs/helpers.js:25:9)
at Function.Module._load (internal/modules/cjs/loader.js:906:15)
at Module.require (internal/modules/cjs/loader.js:1087:19)
at Module.require (pkg/prelude/bootstrap.js:1225:31)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/snapshot/ginit/lib/repo.js:11:17)
at Module._compile (pkg/prelude/bootstrap.js:1320:22) {
code: 'ERR_INSPECTOR_NOT_AVAILABLE'
}
I put the package on github and here is the link: Link to github
Any help is greatly apprecited on how to get this to work.

This Error comes up when we try to Start the executable in DEBUG mode.
Since pkg doesn't allow Inspecting the run-time code of the executable this error Inspector is not available shows up.
I was trying to spawn the executable from another program (which was running in DEBUG mode) and it caused the same issue.
But when I started the program in normal mode, it worked like a charm

Related

Error: Cannot find module '/Applications/Atom.app/***/electron.asar/browser/init.js' while attaching debugger to nodejs

I'm trying to debug my node script using atom-node-debugger plugin.
Below are the commands I used to start the node script -
When I try to attach the debugger I am getting below error -
throw err;
Error: Cannot find module '/Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/Resources/electron.asar/browser/init.js'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:473:25)
at Function.Module.runMain (module.js:683:10)
at startup (bootstrap_node.js:196:16)
at bootstrap_node.js:622:3
Process exited (Port: 9229 (Node attach))
How can I resolve this error?
Am I missing something?
As mentioned in the error, that file does not exist. In the most recent version of Atom (1.38.x at the time of this writing), the file electron.asar is located at Atom.app/Contents/Resources, but not inside the Atom Helper.app.
There are several issues open on GitHub with a similar error. Looks like the package is outdated and no longer actively maintained.

Using nodejs bindings to run native c++ code produces an error

I'm trying to develop an electron app, and I would like to use an npm package that gives vibrancy to a window. This is the package I'm trying to use: https://github.com/sebascontre/windows10-fluently-vibrancy
It uses a visual c++ code to call native windows methods to achieve this vibrancy effect.
I've cloned and I've run the npm install and build as described in the readme and ran the following:
npm install
npm run conf
npm run rebuild
All built successfully and I also see the build\debug artifacts of the c++ build.
When I try to run it (as described in readme):
cd spec\app
electron .
I'm getting the following error message:
Uncaught Exception:
Error: The specified module could not be found.
\\?\F:\Development\windows10-fluently-vibrancy\build\Debug\Vibrancy.node
at process.func [as dlopen] (electron/js2c/asar.js:155:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:857:18)
at Object.func [as .node] (electron/js2c/asar.js:155:31)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at Module.require (internal/modules/cjs/loader.js:715:19)
at require (internal/modules/cjs/helpers.js:14:16)
at bindings (F:\Development\windows10-fluently-vibrancy\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (F:\Development\windows10-fluently-vibrancy\index.js:1:35)
According to the message it cannot find the Vibrancy.node file - But I've verified that it exists in the specified location.
Any ideas how to make it run? I have cloned the package to test it since when trying to use the npm itself in my project it gave the same error so I figured I would try the source.
Today I had the exact same issue you're describing here.
I got it to work using electron-rebuild.
From the root of your project run the command: electron-rebuild
Hope this helps you, if not, maybe someone else.

Error message with electron (node.js): binding.lstat(BaseLong)

I've just started learning electron and created an app yesterday following a tutorial online. The app worked perfectly yesterday, but today I keep getting this error message:
fs.js:1669
binding.lstat(baseLong)
^
Error: EINVAL: invalid argument, lstat 'C:Users\joe\OneDrive\Documents\test-app-electron
at realpathSync (fs.js:1669:15)
at Object.fs.realpathSync (ELECTRON_ASAR.js:330:24)
at toRealPath (module.js:143:13)
at Function.Module._findPath (module.js:192:22)
at Function.Module._resolveFilename (module.js:483:25)
at Function.Module._load (module.js:437:25)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:167:16)
at bootstrap_node.js:589:3
The error message goes on for some time, but I believe the above is the relevant part. I haven't done any changes to my computer, it just stopped working. The fs.js file is part of the "node-modules" folder and not a file I've written or edited anything in.
I then followed the instructions on this page: writing your first electron app, which is just how to create a basic window using electron. I got the same error message. I downloaded an example app and tried running it: same error message.
I have tried uninstalling node_modules with rm -r node_modules and then reinstalling with npm install, with no luck.

Can't run node module geojson-polygon-labels on Windows

I've download the package from "https://github.com/andrewharvey/geojson-polygon-labels/", ran "npm-install" and the node-modules folder was successfully created:
folder - screenshot
However, when cd to bin folder and run "geojson-polygon-labels < v.geojson > v_label.geojson", it throws the eror: "not recognized as internal or external command, operable program or batch file".
I'm really confused at this point. On github it's not really well-documented how to use this tool, and I'm quite new to Node too.
Please help me. Thanks!
Edit: I've tried install it on Ubuntu (subsystem on Windows 10) then run "geojson-polygon-labels" from the bin folder. The same error occured.
Edit2: I figured out to how properly run the tool. On Ubuntu I ran:
./geojson-polygon-labels < polygon.geojson > labels.geojson
However, now a new error pops out:
/home/lamnguyen/geojson-polygon-labels-master/bin/geojson-polygon-labels:25
turf.featureEach(flatInputGeoJSON, (feature) => {
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
What should I do now?
Edit 4: A friend of mine ran it on a "real" Ubuntu with a small sample file and it worked out. Maybe tomorrow I've give a shot :)
In this package I've set up the bin property in the package.json https://docs.npmjs.com/files/package.json#bin so when you run npm install it knows what scripts are executables. You might need to set up your PATH in your shell to the directory NPM installs the binaries to. Or use the full or relative path as you've found out.
The Unexpected Token > message seems like you're running an older version of node which doesn't support ES6 arrow functions, so try upgrading your version of node?

Cannot find module 'unicode/category/So'

When i am trying to run this command - yo mobileangularui, its showing this error. I have read many solutions on the internet but none of them removed this error. Can anyone help?
module.js:341
throw err;
^
Error: Cannot find module 'unicode/category/So'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at symbols (/usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:6:16)
at /usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:123:5
at Object.<anonymous> (/usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:130:2)
There is, sometimes, an issue with npm and executing post install script. Try this steps :
cd /path/to/your/project/node_modules/unicode
check emptiness category directory with ls command
execute this command npm test
If the test is ok, you can continue your work. If it doesn't work check this issue on GitHub.
Hope it help and sorry for my English.
If you are facing this issue and you are behind windows please follow below steps, I hope worked for you :
Remove the unicode module using npm, npm remove unicode
Download the file from
http://unicode.org/Public/UNIDATA/UnicodeData.txt and placed it into
C:\usr\share\unicode-data\ if your project is in C drive, or if you are in
linux /usr/share/unicode or /usr/share/unicode-data
Install unicode again
There is a pending PR which will resolve this - https://github.com/dodo/node-unicodetable/pull/22

Resources