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

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.

Related

React MODULE_NOT_FOUND error even if it should be correct

recently I've been working with react. I had 4 days free and took a rest. Soon as I started again and tried to npm start it displayed error in terminal. Before that I cleared my desktop because it had a lot of folders and I moved that project in other folder. I thought that that might somehow cause the error and I've just tried with new npx create-react-app my-app. However this didn't fix error. It displays it on every single react project I have. I've been googling for 2 hours and tried everything although it didn't work. Can somebody please help.
Error:
The system cannot find the path specified.
node:internal/modules/cjs/loader:936
throw err;
Error: Cannot find module 'C:\Users\nijaz\Desktop\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Thank you for your time.
I found what was problem for me. Actually my folder structure was going like this:
Web Dev & Programming => Udemy ReacJS => -First React Big Project => senbonzakura-food
And this "&" in the "Web Dev & Progamming" was making the probelm.
Just Delete the node_modules directory, Delete the package-lock.json file and Run npm install, Run npm start.
try this:
rm -rf node_modules package-lock.json
Also: You Just need to make Sure that right address path for app.js (it should be app.js, main.js, start.js, server.js, or whatever you picked up) in out Package.json file.
{"npm": .js}
good luck 🤝

package node with pkg ERR_INSPECTOR_NOT_AVAILABLE at run time

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

''adonis' is not recognized as an internal or external command' problem even though I installed the CLI globally

My Windows 10 PC forces me to install CLI and assign environment varriables (happens when I install ionic). This time, same trouble with Adonis. First, the problem is 'adonis' is not recognized as an internal or external command'
To solve this, I have installed Adonis locally in C:\Users\mq003\AppData\Local\node_modules. Which I receive is the only #Adonis directory and it doesn't come with a .cmd file so I can't use this. Therefore, I imported directly the cli from github with npm i -save #adonisjs/cli and copy the .cmd files in npm directory, while others will be put in node_modules (because my Path declare I put the cmd there).
As you can see, all ngrok, ionic, etc. commands belong here. They all work perfectly fine in every terminals.
When I try to type adonis commands, this time, it said.
PS D:\adonis project> adonis --help
internal/modules/cjs/loader.js:626
throw err;
^
Error: Cannot find module 'C:\Users\mq003\AppData\Roaming\#adonisjs\cli\index.js'
?[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)?[39m
?[90m at Function.Module._load (internal/modules/cjs/loader.js:527:27)?[39m
?[90m at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)?[39m
?[90m at internal/main/run_main_module.js:17:11?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
requireStack: []
}
I think it requires #adonisjs directory outside, not in node_modules. So I get that directory out (as you can see in the picture). However, the error still exists.
Editted: I found an issue posted on Github seems relevant to my problem. I will link here in case it helps.
Github

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.

Resources