ElectronJs: Not able to install "install.js:22 throw err" - npm

I am starting with Electron js and I have stumbled on the very first step which is installed Electron.
I am running the following command to install electron provided at
source
npm install electron-prebuilt --save-dev
Following is the result of the command
C:\Users\vikas\Desktop\electron apps\example>npm install electron-prebuilt --sa
ve-dev
electron-prebuilt#0.37.8 postinstall C:\Users\vikas\Desktop\electron apps\exa
mple\node_modules\electron-prebuilt
node install.js
C:\Users\vikas\Desktop\electron apps\example\node_modules\electron-prebuilt\ins
tall.js:22
throw err
^
Error: end of central directory record signature not found
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:167:14
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:473:5
at C:\Users\vikas\Desktop\electron apps\example\node_modules\fd-slicer\inde
x.js:32:7
at FSReqWrap.wrapper as oncomplete
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\vikas\Desktop
\electron apps\example\package.json'
npm WARN example No description
npm WARN example No repository field.
npm WARN example No README data
npm WARN example No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\vikas\AppData\
\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "electron-prebuilt"
"--save-dev"
npm ERR! node v4.4.3
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.37.8 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.37.8 postinstall script 'node install
.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron-prebuilt pac
kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\vikas\Desktop\electron apps\example\npm-debug.log
Windows 8.1
NPM Version 3.8.9

Does C:\Users\vikas\Desktop\electron apps\example\package.json exist? If not try running npm init to create it, and then run npm install electron-prebuilt --save-dev again.

this is bug and a workaround is provided on github : Source
Here is the workaround:
rm -rf ~/.electron/
rm -rf ~/.atom/
npm cache clear
npm install

I was facing a similar issue. But opening the command prompt as administrator (Windows) and reinstalling electron fixed the issue.

Related

npm install code 1 error git dep preparation failed

Has anyone hit the error below when trying to install NPM?
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /home/user1/.nvm/versions/node/v15.12.0/bin/node /home/user1/.nvm/versions/node/v15.12.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/user1/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! The git reference could not be found
npm ERR! npm ERR! command git --no-replace-objects checkout 4.0
npm ERR! npm ERR! error: pathspec '4.0' did not match any file(s) known to git
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /home/user1/.npm/_logs/2021-07-27T07_22_59_809Z-debug.log
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user1/.npm/_logs/2021-07-27T07_24_31_341Z-debug.log
In my case I got that error while using node v16.13.0. After I switched to v10.24.1, it got solved.
I'm on In Windows 10 with node 16.
For me, the solution was either running commands
set NODE_ENV=development
$env:NODE_ENV="development"
or calling the npm install command with admin rights inside PowerShell
By the way, when I switched to node v12, it worked for me as well.

installation of Bower : getting npm ERR

I have node and nodenv installed on my Ubuntu 16.04
I want to install bower
npm install -g bower
I am getting this :
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop
working at any moment because its dependencies can change. Prevent
this by migrating to Yarn:
https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm ERR! Linux 4.4.0-94-generic
npm ERR! argv "/home/mypc/.nodenv/versions/4.6.0/bin/node" "/home/mypc/.nodenv/versions/4.6.0/bin/npm" "install" "-g"
"bower"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! shasum check failed for /tmp/npm-4594-c12fe2a2/registry.npmjs.org/bower/-/bower-1.8.2.tgz
npm ERR! Expected: adf53529c8d4af02ef24fb8d5341c1419d33e2f7
npm ERR! Actual: ca90d0b92af2557a3f8e9116ba83b3fc4ad7828
npm ERR! From: https://registry.npmjs.org/bower/-/bower-1.8.2.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues>
The npm client is unable to verify the downloaded file from the npm registry:
shasum check failed for /tmp/npm-4594-c12fe2a2/registry.npmjs.org/bower/-/bower-1.8.2.tgz
Expected: adf53529c8d4af02ef24fb8d5341c1419d33e2f7
Actual: ca90d0b92af2557a3f8e9116ba83b3fc4ad7828
How to fix?
If you have a corporate proxy in between, make sure it doesn't modify the content of your downloaded files.
If there is no proxy involved, retry the installation.

npm error installing serialport

I'm trying to use node.js serialport package but it give some errors that I don't understand.
To simplify, I start form a clear directory 'test' and I create a new app:
sudo npm init
Then I try to install serialport:
sudo npm install serialport --save
but I've got this error:
serialport#5.0.0 install /*********/test/node_modules/serialport
node-pre-gyp install --fallback-to-build
env: node: No such file or directory
npm WARN test#1.0.0 No description
npm WARN test#1.0.0 No repository field.
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! serialport#5.0.0 install: node-pre-gyp install --fallback-to-build
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serialport#5.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myUser/.npm/_logs/2017-09-17T20_33_23_435Z-debug.log
I've tryed with other versions, clear npm cache, and other strange things, but I don't get any solution.
Versions:
OSX 10.8.5
node -v: v8.4.0
Thanks!
Ok.
I've resolved it with this order to install:
sudo npm install serialport --unsafe-perm --build-from-source
as the serialport web page says:
https://www.npmjs.com/package/serialport
Thanks for all!

How to Fix Error "user admin is not allowed to access package"

I am updated now and running
node v5.0.0
npm v3.3.6
On a Mac (El Capitan)
When i run "npm install" on my project now. I get errors like this:
me:controls me$ sudo npm install
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/0.10.36/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code E403
npm ERR! user admin is not allowed to access package chai : chai
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/Dev/controls/npm-debug.log
Im not seeing any solutions to this around the web yet? I tried both sudo and not sudo and makes no difference.
Any suggestions?
I had the same problem. Check the registry: npm config list.
Try to run:
npm set registry "https://registry.npmjs.org/"
and then npm i again.
I used sinopia as a registry. Sinopia can't work with scoped packages.

yodoctor: command not found when installing yo from terminal

Below is the error I keep getting. It seems to indicate a "post-install" issue with yodoctor. Sadly yodoctor is the advice given by the yeoman team to help with this issue. I have other node_modules installed (bower, grunt, typescript).
sh: yodoctor: command not found
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/bin/npm" "install" "-g" "yo"
npm ERR! node v5.0.0
npm ERR! npm v3.3.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! yo#1.5.0 postinstall: `yodoctor`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the yo#1.5.0 postinstall script 'yodoctor'.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! yodoctor
npm ERR! You can get their info via:
npm ERR! npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jesselawson/.node_modules_global/lib/node_modules/npm-debug.log
This error is generally caused because someone used sudo at some point and messed up their npm package directory permissions. As a rule of thumb, never ever use sudo.
So how can you fix it? Here's a couple troubleshooting points:
Make sure you update npm to the latest version (npm install -g npm). npm 2.x had some race conditions that would try to run yodoctor before it is installed.
Make sure the global npm module folders is chown/chmod to your user.
Make sure npm module binaries is in your PATH.
If nothing works, then you can force install it by running npm i -g yeoman-doctor && npm i -g yo - but that really is a last recourse solution.
Just the following command would do the trick:
sudo npm install -g yo
if not, find where yo is, add it to the path as follows:
export PATH="$PATH:<path where yo is installed>"