"Error: spawn cmd ENOENT" In Expo Init Project - node.js

I am starting a new React-Native Project using
expo init firstexpo
But I get this error at Command Prompt
Error: spawn cmd ENOENT
PS C:\Users\Alex\testing\firstexpo> expo start
[16:21:09] Starting project at C:\Users\Alex\testing\firstexpo
[16:21:11] Expo DevTools is running at http://localhost:19002
[16:21:11] Opening DevTools in the browser... (press shift-d to disable)
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
PS C:\Users\Alex\testing\firstexpo>
npm start error Cannot find module 'opn'
[16:38:49] Starting project at C:\Users\Alex\testing\firstexpo
[16:38:52] Expo DevTools is running at http://localhost:19002
[16:38:52] Opening DevTools in the browser... (press shift-d to disable)
[16:38:52] Cannot find module 'opn'
[16:38:52] Set EXPO_DEBUG=true in your env to view the stack trace.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! empty-project-template# start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the empty-project-template# 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:
npm ERR! C:\Users\Alex\AppData\Roaming\npm-cache\_logs\2018-11-24T08_38_52_344Z-debug.log
I am very new to coding, can anyone tell me how can I solve the problem?
Thank you very much.
Downgrade to v28

I solved my error using this. "%SystemRoot%\system32;" in the PATH variable.

1- First you need to edit system environment variable and locate where you have Windows Poweshell so add new in "system environment variable path"
2- Then Open Window PoweShell as An Administraror And Write these Two Commands :
:) Upgrade Window PowerShell because your nodejs and npm is updated but powershell is not updated so its making conflict with your npm start or expo start,so you should need to upgrade windows powershell
And Then run Cmd and also run your poject npm start or expo start so quickly it will work!
BEST OF LUCK!

I got this error everytime I tried to open my app in Expo Go. I did clean all the Expo Go app data in my cell phone and my app run again.

Related

I get error when running npm start in vs code

(node:6852) [LRU_CACHE_OPTION_maxAge] DeprecationWarning: The maxAge option is deprecated. please use options.ttl instead
(Use `node --trace-deprecation ...` to show where the warning was created)
> mynodejsapp#0.0.0 start
> node ./bin/www
npm ERR! code ENOENT
npm ERR! syscall spawn C:\Windows\system32\cmd.exe;C:\MinGW\bin
npm ERR! path C:\Users\TECHNOCITY9645075247\Desktop\web designing\myNodejsApp
npm ERR! errno -4058
npm ERR! enoent spawn C:\Windows\system32\cmd.exe;C:\MinGW\bin 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\TECHNOCITY9645075247\AppData\Local\npm-cache\_logs\2022-03-13T10_44_05_635Z-debug-0.logenter code here
this is the error showing in the terminal
my node and npm versions are upto date
Try to reinstall Node.js. Should work as it worked for me.
Uninstalling the Node.js
Clear the npm cache by running the following command in your terminal.
npm cache clean --force
Go to the windows control panel and click on Uninstall a program, select Node.js and click on uninstall tab to uninstall the node and npm successfully.
Restart your system.
Verify if node.js and npm are completely uninstalled from your system using:
node -v
If the above command prints command not found then you’re successfully uninstalled, otherwise look into the below directories and remove the contents manually.
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
Looks you're facing the problem of using maxAge instead of expires
look at this link Can't set cookie 'expires' or 'maxAge' in Node.js using Express 3.0
Maybe help you for better resolution into the issue.
Try to reinstall Node.js.
Should work as it worked for me.
Try to clean your cache then reinstall Node.js. Should work as it worked for me.

react-scripts: command not found (npm start)

I've been using create-react-app without issues for some time, but recently, after running it, I cannot start the development server. After running npm start, I get the following error:
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! js-calculator#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the js-calculator#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Scripts appear to be in the correct location and correctly configured in the package.json file.
Also, npm start throws me the same error if I run it in other react-apps folders that used to work before.
I tried various suggestions I found here on stackoverflow:
installing create-react-app globally;
reinstalling dependencies (npm install);
reinstalling react scripts (npm install react-scripts --save);
updating node and npm;
but none of the above worked.
Any suggestions?
I've also a more detailed .log file, in case anyone wants to have a look at it.
After many tries and more reading of related issues here on SO, I found the cause. One of my react-app parent folders (five levels above) name was "example/example"; naming it to "example-example" solved the problem.

npm start not working for react native setup

Hei,
I'm new to programming and trying to Setup my toolchain and create a new React Native project.
If needed, install code editor (+ extensions), git, npm
Install the Expo app to your phone. iOS or Android
Use the expo CLI tool to generate an app skeleton
Create a folder for your React Native projects
use Git Bash or terminal to go to this folder cd foldername/otherfoldername/etc...
npm install -g expo-cli
expo init MyApp --npm
choose 'blank' template
if this fails on Windows due to missing interactive mode, use cmd instead of Git Bash
Test that app works; run it and open in the browser (the interactive shell is needed to get the menu option (w) for launching in browser)
cd MyApp
npm start <---
From now on open 'MyApp' folder in your editor/IDE to edit your project
Create a remote git repository (Github) and push your app there
I have done these but I get this error when I write in my VScode npm run
expo start
Starting project at C:\Users\35845\Documents\ReactNativeProject\MyApp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell 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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: expo start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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:
npm ERR! C:\Users\35845\AppData\Roaming\npm-cache_logs\2020-08-26T08_53_44_736Z-debug.log
Can someone please help me with this. Thank you
use cmd instead of git bash or PowerShell on windows and try below steps and run:-
Delete node_modules folder
run npm cache clean --force
npm install
expo start
make sure you are inside your application folder (where package.json is present)

react scripts not found

I have a problem running npm start from my newly created project, the thing is the problem doesn't seem to occur outside of this folder (its a git repo, so it needs to be in here). If i create a new project in another folder and run npm start I have no issues at all.
So I recently started working in Ubuntu 18.04LTS, gone through all the setup of installing nodejs and npm.
Currently running versions:
node = 10.16.0
npm = 6.9.2
So I created my app by using npx create-react-app
When i run npm start inside this, it throws me an error:
sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! frontend#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the frontend#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
I tried create the app in another folder, testing if i can run npm start (yes) and the move this app to my repo, but then it fails again.
If i understand well what you wrote, "npm start" worked fine when you changed folders. If this is the case, you should know that Node has issues reading the path when some particular characters (like "&") or spaces are in the name of a folder.
Try to change the folder's name.

React and Node.js

I installed the Tutorial: Intro to React. ( tic-tac-toe game ) in Dropbox in Windows 10 Pro on a Desktop. I installed Ubuntu with zsh and installed Node.js using curl. The app starts in zsh or Bash.
However in my laptop I am unable to get the app to start in Bash, zsh, or the windows command terminal. Am I not able to use React in Dropbox on multiple computers?
Here is the message I get....Why is the script not recognized?
> tic-tac#0.1.0 start C:\Users\Doak\Dropbox\Apps\tic-tac
> react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tic-tac#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tic-tac#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I also installed a tutorial 'React For Beginners' in another directory in Dropbox and it works fine.
Thanks

Resources