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)
Related
I am trying to run a npx command on my M1 MacBook but I keep getting the same error. I already installed node.js and npm so that I could run this command:
npx #mondaydotcomorg/monday-cli scaffold run ./ quickstart-react
However, when I run this command the output is:
> Repository was downloaded successfully
> Copying the directory
> Installing packages. It can take a few moments
> Node modules were installed successfully
> Running the project
Error: Command failed: npm run start
at ChildProcess.exithandler (node:child_process:389:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:757:14) {
code: 1,
killed: false,
signal: null,
cmd: 'npm run start'
}
Before, I was getting an issue saying sh: concurrently: command not found and kill-port: command not found so I installed concurrently and kill-port using npm, which removed this error messages. However, now I get the output above. I installed node.js again and updated npm version to latest version, but no change. Any suggestions on how to fix this?
Edit: I found this link that is a solution to my exact problem. (https://community.monday.com/t/monday-cli-seems-not-to-work-on-apple-m1/36745). I ran npm install kill-port and ran npm upgrade and both executed correctly. However, when I try to run npm run start command by itself, this is my output:
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mattspc/.npm/_logs/2022-07-18T21_08_52_459Z-debug-0.log
I think I need to find my destination folder and cd to it, then run npm run start within that folder. Any advice on how to locate it?
Finally figured out an answer to my own question. The main issue was my npm version and node.js version.
To get the latest stable version of npm, run this command in terminal npm install -g npm#latest and make sure you download the correct node.js version (this one is for Apple Silicon Chip/M1, select the option on the left). Then, run nvm use --lts command in terminal to make sure you are using the correct and most stable node.js version. Finally, look in the main directory (firstnamelastname folder on Mac) and delete the quickstart-react folder if it already exists. Then, run npx #mondaydotcomorg/monday-cli scaffold run ./ quickstart-react in terminal (if there is an error message, quit terminal and reopen it, then continue with the next step). You need to run the next part locally, so do cd quickstart-react, then npm run start and it should work. If there is any error message and it says something like sh: kill-port: command not found you need to install that specific dependency within the quickstart-react folder, so search up "npm install kill-port" or "npm install ____" depending on the error, quit and reopen terminal, do cd quickstart-react and run those install commands inside the quickstart-react folder. Should work after that.
If this doesn't work try using this link (https://community.monday.com/t/problem-to-setup-development-environment-quick-start-guide-with-cli/9422) that shows how to manually do this (this didn't work for me however).
I want to start my React app, but when I run npm start, I get this error:
npm ERR! syscall open
npm ERR! path C:\Users\Muchendu\Documents\GitHub\Steve-React/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Muchendu\Documents\GitHub\Steve-React\package.json'
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\Muchendu\AppData\Local\npm-cache\_logs\2022-05-11T09_26_37_201Z-debug-0.log
This could be because right after running
npx create-react-app <your_app_name>
you are trying to run npm start
Instead try switching into your app directory like so:
cd <your_app_name>
because that is where your package.json will most likely exist and then try running
npm start
run this command in the terminal inside your project npm init -y.
This will generate a package.json in your project.
Otherwise since you are making a react app use the npx create-react-app your-app-name this will create all the necessary files for running you application.
What is package.json?
The package.json file is the heart of any Node project. It records important metadata about a project which is required before publishing to NPM, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package.
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.
Any time I try to run npm start I get an error saying:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! dbproject#0.1.0 start: set PORT=9999 && react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the dbproject#0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
So far I've tried:
-Changing environment variables, my current environment variables are these
-Cleaning the npm cache, deleting the node_modules and then running npm install again
-I tried running npm start in different project folders, none of the React projects work, they all throw the same error. Node servers run well, I haven't tried running anything else.
Pastebin of the full console log: https://pastebin.com/P8DDDaDq
Pastebin of the debug.txt file: https://pastebin.com/1ebezKX2
I'm running Windows 10 Home Build 17134.
I would be extremely grateful of any help
Problem solved!
Leaving the solution that worked for me here in case it is helpful for anyone.
Here's what I did:
1.- Uninstall node
2.- Restart your computer
3.- Install node again
4.- Install React running npm install -g create-react-app
5.- Create a new React project folder running npm create-react-app yourProjectName, place all your project files here except for the node_modules folder and the package.json files
6.- After you have done that install all of your dependencies manually with npm, it should work fine now!
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.