Created Electron app but when I run "npm start" it doesn't start the app - node.js

I'm trying to install electron so I can create an app. I have the latest npm installed (8.3.1) and when I run "npm install electron --save-dev" I keep getting this error:
PS C:\Users\archa\HCIRA\blah> npm install electron --save-dev
npm ERR! code 1
npm ERR! path C:\Users\archa\HCIRA\blah\node_modules\electron
npm ERR! command failed
npm ERR! command bash -c node install.js
npm ERR! Windows Subsystem for Linux has no installed distributions.
npm ERR! Distributions can be installed by visiting the Microsoft Store:
npm ERR! https://aka.ms/wslstore
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\archa\AppData\Local\npm-cache\_logs\2022-01-
15T14_42_33_350Z-debug-0.log
"blah" is the folder where all my code is (index.js, package.json etc.). I've tried using the resources I found on Stack and GitHub but none of them have worked out for me at all. I was even told that the "--save-dev" suffix would be useful for installing Electron on Windows but it didn't work.

Related

Installing dependencies with npm-peer-dependencies

I am trying to install the required node_modules for a small project running Angular 11 using npm install
My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI.
After running the install command I tried npm start.
I was expecting that after running the install and start command to be able to run the project locally.
However the actual result I get after running the install command is the following list of errors:
> ng serve
An unhandled exception occurred: Cannot find module '#angular/compiler'
Require stack:
\node_modules\#angular\compiler-cli\index.js
\node_modules\#ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\#ngtools\webpack\src\index.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\#angular-devkit\build-angular\src\browser\index.js
\node_modules\#angular-devkit\build-angular\src\dev-server\index.js
\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\#angular-devkit\architect\node\index.js
\node_modules\#angular\cli\models\architect-command.js
\node_modules\#angular\cli\commands\serve-impl.js
\node_modules\#angular-devkit\schematics\tools\export-ref.js
\node_modules\#angular-devkit\schematics\tools\index.js
\node_modules\#angular\cli\utilities\json-schema.js
\node_modules\#angular\cli\models\command-runner.js
\node_modules\#angular\cli\lib\cli\index.js
\node_modules\#angular\cli\lib\init.js
\node_modules\#angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #0.0.16 start 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:
The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies.
What should I do next to get this Angular project installed locally ?
The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine.
The steps that you should take are to make sure of them are globally installed.
To install packages globally you need run npm install -g <package_name>
npm docs link
In your case for angular cli you should run
npm i -g #angular/cli#11.2.15 and npm install -g npm-peer-dependencies.
Then run npm start.

npx start, npx install npx init is not working

I have been working with react for years using NPX and yarn and I just got assign to built an app with react-native using react native-cli so i tried setting up my environment using the react native docs and some YouTube videos. But after following the instructions like downloading android studios and adding in my new environment variable, I'm getting an error every time i tired to run
"npx react-native init AwesomeProject" which gave me this error
[![npx react-native init result][1]][1]
I also tried npm install and i got this error on git bash and also on my commandline
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Dennis\Desktop\GitHub\LCRN01-travel-onboarding-app-master\LCRN01-travel-onboarding-app-master\node_modules\core-js
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dennis\AppData\Local\npm-cache\_logs\2021-11-13T05_50_35_592Z-debug.log```
and also npx react-native start is showing this error on git bash
```openssl config failed: error:02001003:system library:fopen:No such process
Command `start` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.```
I have tried running "npm cache clean --force"
but still nothing changed
I can't even run npx create-react-app anymore because i keep getting this error
npx creat-react-app test
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/creat-react-app - Not found
npm ERR! 404
npm ERR! 404 'creat-react-app#latest' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dennis\AppData\Local\npm-cache_logs\2021-11-13T06_05_46_068Z-debug.log
I'm currently using a windows 10 device
node -v 16.13.0
npm -v 8.1.3
[1]: https://i.stack.imgur.com/OTLYj.png
It's create-react-app.
Not totally sure but another issue could be that your Git bash isn't in your PATH.
Plus, npx start and npx install doesn't sound right, maybe you meant npm start and npm install.
On top of that, it seems you have node v11 and not node v16, maybe you have different versions of node, some in Windows' PATH and some only accessible from bash.
It could help to clean up and reinstall your node versions and Git bash, also check your environment variables for remnants of previous versions, and make sure to not confuse npm and npx.

Cypress installation failed

I installed nodejs and npm on windows 10. Than I tried to install cypress via npm install cypress --save-dev and get the following Error:
> node index.js --exec install
The command "node" is either misspelled or
could not be found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress#3.8.2 postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress#3.8.2 postinstall 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! C:\Users\U\AppData\Roaming\npm-cache\_logs\2020-01-21T11_05_01_566Z-debug.log
After this I added the path %USERPROFILE%\AppData\Local\Temp to my system environment variables. But I get this error messages again. How can I fix this problem?
try the following steps :
install git on your machine and config it as global.
delete old package.js then re-init new package.
try again cypress install command
Try this instead by installing the previous version but Explicitly: npm install cypress#8.1.0 --save-dev
Download it in the any directory its a hack to download, if your proxy is properly configured and internet speed is good. it will download while doing npm install
wget https://cdn.cypress.io/desktop/7.6.0/win32-x64/cypress.zip
Provide the zip location
CYPRESS_INSTALL_BINARY=~/Downloads/cypress.zip npm install cypress
Remember to actually run the npm command inside your folder with the package.json.
Delete the package.json.
Again re build the package by npm init.
Install Cypress again by using npm install cypress --save-dev.

Installing github hosted npm dependencies with Docker

I'm trying to dockerize a project, but I'm having issues in the npm install process with my Gulp 4 dependency. I'm using Gulp 4 because we needed some of the new features, but all the instructions I've seen for using the prerelease version of Gulp 4 is to use the github branch url. Here is the offending dependency:
"gulp": "github:gulpjs/gulp#4.0",
And here is the error I get when I try to run docker build -t user/project .:
npm ERR! Error: No compatible version found: gulp#'github:gulpjs/gulp#4.0'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.7","0.0.8","0.0.9","0.1.0","0.2.0","1.0.0","1.1.0","1.2.0","1.2.1","2.0.0","2.0.1","2.1.0","2.2.0","2.3.0","2.4.0","2.4.1","2.6.0","2.6.1","2.7.0","3.0.0","3.1.1","3.1.2","3.1.3","3.1.4","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.3.0","3.3.1","3.3.2","3.3.4","3.4.0","3.5.0","3.5.1","3.5.2","3.5.5","3.5.6","3.6.0","3.6.1","3.6.2","3.7.0","3.8.0","3.8.1","3.8.2","3.8.3","3.8.4","3.8.5","3.8.6","3.8.7","3.8.8","3.8.9","3.8.10","3.8.11","3.9.0","3.9.1"]
npm ERR! at installTargetsError (/usr/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at /usr/lib/node_modules/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/lib/node_modules/npm-registry-client/lib/get.js:148:7)
npm ERR! at /usr/lib/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:108:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.19.0-51-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /src
npm ERR! node -v v0.10.42
npm ERR! npm -v 1.3.6
This is the Dockerfile I'm currently using:
# Using CentOS
FROM centos:centos6
# Enable Extra Packages for Enterprise Linux (EPEL) for CentOS
RUN yum install -y epel-release
# Install Node.js and npm
RUN yum install -y nodejs npm
COPY package.json /src/package.json
# Install app dependencies
RUN cd /src; npm install
# Bundle app source
COPY . /src
# Run server
EXPOSE 8080
CMD ["npm", "start"]
Is there a way to get Docker to be ok with the github url? Or is there an alternate way to include the dependency that Docker would be happy with?
The issue was caused by older version of node available on the base image.
The version of node was not compatible with gulp version.
A base image with newer version of node resolved the issue.

"Permission Denied" in Node on Linux, when running start-script /w local nodemon/mocha/babel-node

I'm having issues with my new linux setup - I've installed nodemon as a local dependency (NOT globally) and I'm trying to execute it from my package.json "start"-script. I'm getting this permission error.
node by itself works great, but as soon as I try to use babel-node or nodemon or even mocha, I get permission problems.
My setup is divided across 2 hard drives - node is installed on my SSD (with my OS), and my project (and it's node_modules, where I'm trying to execute nodemon from is on my storage-HDD.
sh: 1: nodemon: Permission denied
npm ERR! Linux 3.19.0-56-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v5.9.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! vyggo-easyrtc#1.0.0 start: `nodemon --exec node entry`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the vyggo-easyrtc#1.0.0 start script 'nodemon --exec node entry'.
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 vyggo-easyrtc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon --exec node entry
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vyggo-easyrtc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vyggo-easyrtc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /media/goatic/HDD/Projects/Node/vyggo-easyrtc/npm-debug.log
goatic#goatic-laptop:/media/goatic/HDD/Projects/Node/vyggo-easyrtc$
I had this problem after changing moving my project from an NTFS filesystem to linux. I changed all the file/directory permissions to 644/755 and also set the owner/group. That's when I started getting this error.
When I tried nodemon in the terminal, I got command not found. Strange.
Reinstalling nodemon fixed it:
sudo npm install -g nodemon
My secondary drive was incompatible with my linux OS in terms of permissions, as it was an NTFS partition.
I ended up moving everything to my primary drive, and of course permissions were working again, allowing me to execute local dependencies.
I guess the solution to my problem, had I relied on keeping projects on the secondary drive, would be to format it to a format compatible with Linux permissions.
If you are installing in MAC Use.
sudo npm install -g nodemon --unsafe-perm.
It will work.
I had the same problem. In my case when I changed my operating system to Linux Ubuntu, 20.04.1 Version, reinstalling nodemon solved the problem.
For Linux users:
sudo npm install -g nodemon
for Windows users, open a new terminal or cmd prompt just write:
npm install -g nodemon
For more information check nodemon documentation:
nodemon documentation
I counter this problem when I git clone a project which initially created on a Windows machine, my simple solution is to delete the .node_modules directory and then run npm install, which solved my problem.
very weird, I had the same problem except I solved it by replacing Nodemon devStart with nodemon devStart and suddenly the error was gone :)

Resources