react native windows, spawn npm ENOENT error - node.js

I am trying to run react-native on windows and get the following error:
C:\Program Files>react-native init AwesomeProject
This will walk you through creating a new React Native project in
C:\Program Fil es\AwesomeProject Installing react-native package from
npm... events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at exports._errnoException (util.js:860:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:450:9)
at process._tickCallback (node.js:364:17)
at Function.Module.runMain (module.js:459:11)
at startup (node.js:136:18)
at node.js:972:3
How do I fix this?

This should be fixed in React Native CLI 0.1.9. To update your CLI:
npm uninstall -g react-native-cli
npm install -g react-native-cli
There was a regression in 0.1.8, reported here: https://github.com/facebook/react-native/issues/5169

Check if the gradlew.bat file is present in the android folder if it is not there then simply copy gradlew.bat file from another project.

react-native-cli#0.1.8 error
Rollback react-native-cli#0.1.7
everything is ok.

To fix this, Reinstall NodeJS https://nodejs.org/en/
Then
npm install -g react-native-cli --vebrose
react-native init App --verbose
If it still fails, try installing Python 3 https://www.python.org/ and repeat the process.

Related

Why npm start is getting error for react project?

I'm trying to start a React application, with npm but I get this error:
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
I'm using node version 10.16.3 and npm 6.13.6. I've cleaned npm cache and install npm again, but I'm getting always the same error
I suggest doing these three steps:
npm install -g npm#latest to update npm because it is sometimes buggy.
rm -rf node_modules to remove the existing modules.
npm install to re-install the project dependencies.
the problem is fixed , i've installed another version of "react-scripts" , because the actuel version is not stable , so i use to overwrite it with the given version, so use this command to install :
npm install react-scripts#2.1.8
Once the installation is completed your can run your reac app :
npm start

npm start fails with events.js:174 throw err; on Ubuntu 18.04

I have been trying to get the basic electron-quick-start demo working on Ubuntu 18.04. Everything works up to the point that I try: npm start at which point I get this error:
> electron .
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn /home/me/docs/electron-quick-start/node_modules/electron/dist/electron EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-quick-start#1.0.0 start: `electron .`
npm ERR! Exit status 1
I have tried clearing the npm cache, rebooting, and nothing seems to work.
There seem to be two versions of node.js installed:
node -v ==> v10.15.3
nodejs -v ==> v11.15.0
Both these versions are probably the result of trying to upgrade node.js to a newer version than what comes with Ubuntu, though I don't know why or how. I upgraded following the instructions on this webpage - https://github.com/nodesource/distributions:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
When that didn't work I tried again with vers 11.x.
My version of npm is: 6.9.0
Why are there two versions of node.js? Could this be the problem?
What should I do to get npm start to work? If clearing everything and starting over is the best approach, I am all for it. This is my first time using node.js, so I am totally lost here. BTW, downloaded electron apps (e.g. VS Code) seem to be working just fine if that's any help.
Solution 1: Try to find the exacly npm/node version your project are using to install.
Better use a npm version manager like nvm.
Solution 2: On linux bash execute:
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p
The reason?
the OS have a max handle files count. You need to increase this.
Why?
did you realize how many files the node_modules folder has on the smallest/simplest project you have? Now, try to imagine on medium/large project.

Error when create jhipster sample 21-points application

Follow the official guide I installed nodejs, yoman, bower, gulp and generator-jhipster in my mac. After executed "yo jhipster" command it shows something error occured. Where is wrong? I can run "./mvnw" and startup server but the home page hints me there is something error.
npm install -g yo
npm install -g bower
npm install -g gulp
npm install -g generator-jhipster
yo jhipster
...
bootstrap#3.3.7 src/main/webapp/bower_components/bootstrap
└── jquery#3.1.0
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn gulp ENOENT
at exports._errnoException (util.js:1026:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
it should be npm install -g gulp-cli
See the doc:
Install Gulp: npm install -g gulp-cli (If you have previously
installed a version of gulp globally, please run npm rm -g gulp to
make sure your old version doesn’t collide with gulp-cli)
Also take care of using an LTS version of NodeJS.

Failed at the phantomjs-prebuilt#2.1.13 install script 'node install.js'

I am trying to install phantomjs on a windows 7 machine and am getting this error .
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodist\\v\\nodev5.5.0\\node.exe" "C:\\Program Files (x86)\\nodist\\bin\\node_mod
ules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v5.5.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! phantomjs-prebuilt#2.1.13 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt#2.1.13 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
There are many issues logged in the phantomjs github repo for the same or this SO questionbut none of it is helping in my case.
This is what is the state of my machine
I have phantomjs installed locally at C:\npm\phantomjs-2.1.1-windows\bin\phantomjs.exe but when I run the npm install,it will always try to install by downloading which is where the problem for me.My corporate proxy is blocking the direct downloads .I also cannot use the --phantomjs_cdnurl switch mentioned here https://www.npmjs.com/package/phantomjs#deciding-where-to-get-phantomjs
I can run the command and it works fine
phantomjs -v
2.1.1
But when I run npm install on my project it is trying to install the phantomjs and will run into the above error.Another thing I observed from the npm log
Considering PhantomJS found at C:\Program Files (x86)\nodist\bin\phantomjs.CMD
Found PhantomJS at C:\Program Files (x86)\nodist\bin\phantomjs.CMD ...verifying
Error verifying phantomjs, continuing { [Error: Command failed: C:\Program Files (x86)\nodist\bin\phantomjs.CMD --version
it is trying to run the phantomjs.CMD --version which also failing
Error verifying phantomjs, continuing { [Error: Command failed: C:\Program Files (x86)\nodist\bin\phantomjs.CMD --versio
n
internal/child_process.js:274
var err = this._handle.spawn(options);
^
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:274:26)
at exports.spawn (child_process.js:362:9)
at Object.<anonymous> (C:\Program Files (x86)\nodist\bin\node_modules\phantomjs-prebuilt\bin\phantomjs:22:10)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Program Files (x86)\\nodist\\bin\\phantomjs.CMD --version' }
As a temporary work around I am able to get it installed by using --ignore-scripts
npm install phantomjs-prebuilt#2.1.13 --ignore-scripts
I also logged an issue in the github repo for the same
https://github.com/Medium/phantomjs/issues/649
edited
This issue was part of the build process script I was using and it does a npm clean and install everytime with a bunch of other things .So this issue appears many times in the same machine where we automated tests using phantomjs. I got some time to look into this issue and it seems my corporate proxy is blocking the download from https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip. I knew this before and had manually installed phantomjs binary and added to system path but the npm install still trying to download locally as showing in the log below.
Considering PhantomJS found at C:\npm\phantomjs-2.1.1-windows\bin\phantomjs.EXE
Looks like an `npm install -g` on windows; skipping installed version.
My corporate proxy was blocking all the phantomjs CDN urls as well (https://www.npmjs.com/package/phantomjs)
The work around I used was to get the phantomjs-2.1.1-windows.zip and copy it to the C:\Users\<username>\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip and that resolved the issue with the build script.If someone cleans the temp directory,issue will come back. Even this is a work around but the corporate proxy cannot be unblocked for obvious reasons :)
Hope this helps someone!
I came across same error , It will solved by following changes, Hope it will help you .
sudo npm install phantomjs-prebuilt#2.1.13 --unsafe-perm
Sometimes when we try to install phantomjs locally, it will work. But for global, I suggest you to type
sudo npm install -g phantomjs-prebuilt --unsafe-perm
Please remove any vpn connected in your system. I removed office vpn and then hit npm install it worked fine for me.
All those solutions didn't help me
--ignore-scripts helped but finally installed phantomjs is unworkable and my karma tests were not able to use phantomjs browser.
However I found solution for my Win machine. I downloaded distribute with .exe file from https://phantomjs.org/download.html and then unpacked locally (it can be any folder):
then added to:
set Path=;C:\Users\admin\AppData\Roaming\phantomjs-2.1.1-windows\bin;$Path
After that 'npm install' was able to re-use it:
[exec] > node install.js
[exec]
[exec] Considering PhantomJS found at C:\Users\admin\AppData\Roaming\phantomjs-2.1.1-windows\bin\phantomjs.EXE
[exec] Found PhantomJS at C:\Users\admin\AppData\Roaming\phantomjs-2.1.1-windows\bin\phantomjs.EXE ...verifying
[exec] Writing location.js file
[exec] PhantomJS is already installed on PATH at C:\Users\admin\AppData\Roaming\phantomjs-2.1.1-windows\bin\phantomjs.EXE
[exec]
[exec] > phantomjs#2.1.7 install C:\xxx\client\ui\src\main\web\build\node_modules\phantomjs
[exec] > node install.js

Error when running famous dev on famo.us

I am installing famo.us, and I created a project, then went into the folder and ran famous dev like it says here, but then I get an error:
http://famous.org/get-started.html
C:\Users\Me\Desktop\Apps\Messenger>famous create messenger
Seed project created at: C:\Users\Me\Desktop\Apps\Messenger\messenger
C:\Users\Me\Desktop\Apps\Messenger>cd messenger
C:\Users\Me\Desktop\Apps\Messenger\messenger>famous dev
Node Modules not yet installed, attempting to do so now.
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
C:\Users\Me\Desktop\Apps\Messenger\messenger>
It's a known issue in windows.
First run npm install from the command prompt.
Then, in package.json change the "dev" line under "scripts" to:
"dev": "npm run watch | serve public/ -p 1618",
and then run npm run dev from the command line (instead of famous dev)
The error when running famous dev has been resolved as of Famous-cli version 0.2.8
Run this command at the command line with npm enabled
npm update -g famous-cli
Note: There is an issue with parallel commands in windows using npm so you will not get a watched server when running famous dev from the default famous create seed as of version 0.2.8

Resources