Npm Start: getting error while starting starting server - react-native

I'm trying to run npm server but i'm getting that error
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:268:19)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
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\Danger World\AppData\Roaming\npm-cache\_logs\2020-09-02T10_54_16_635Z-debug.log
Anyone can please help me

solution 1 ---
First add powershell to PATH as %SystemRoot%/system32/WindowsPowerShell/v1.0.
open powershell as admin and write this command Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force.
last thing fire npm-windows-upgrade.
solution 2 ---
Add %SystemRoot%/system32/WindowsPowerShell/v1.0 to your PATH Variable,
cmd+q and search env and hit enter
click environment variables in the advanced tab
find Path/PATH variable and click edit
Click new and paste %SystemRoot%/system32/WindowsPowerShell/v1.0
click ok and restart your terminal and try installing again

Related

Error: “The operation was rejected by your operating system” when trying to update expo-cli

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli
npm ERR! dest C:\Users\Avinash\AppData\Roaming\npm\node_modules.expo-cli-MaHHbGHy
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\Avinash\AppData\Roaming\npm\node_modules.expo-cli-MaHHbGHy'
npm ERR! [Error: EPERM: operation not permitted, rename 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\Avinash\AppData\Roaming\npm\node_modules.expo-cli-MaHHbGHy'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\expo-cli',
npm ERR! dest: 'C:\Users\Avinash\AppData\Roaming\npm\node_modules\.expo-cli-MaHHbGHy'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Avinash\AppData\Local\npm-cache_logs\2020-11-28T06_08_17_131Z-debug.log
Please try following steps:
check your antivirus status is enable or disable
disable your antivirus during the installation.
I hope this helps. It worked for me.
Open cmd as administrator , this is permission error
Also try to see if the file is in use :
https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
https://helpcenter.gsx.com/hc/en-us/articles/115015880627-How-to-Identify-which-Windows-Process-is-Locking-a-File-or-Folder
Open Process Explorer
Running as administrator. On the toolbar, find the gunsight icon on the right. Drag the icon and drop it on the open file or folder
that is locked. The executable that is using the file will be
highlighted in the Process Explorer main display list.
Alongside opening your command prompt window with administrator privileges, try killing the process adb.exe, which can be found by opening your Task Manager and navigating to the Details tab. This GitHub issue has a few other possible solutions you can try.
I found it was because I had the folder open in my code editor. Closed it and ran the npm install command and it worked.
Check if you have explorer or some folder open. Closing that folder/explorer solved my problem

metro boundler does not work - expo/react native

I want to run a react native app by those commands:
npm i -g expo-cli
expo init myapp
cd myapp
npm start
but I get the following error and the metro boundler not work:
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
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\nathan-hp\AppData\Roaming\npm-cache\_logs\2020-09-22T14_48_10_269Z-debug.log
I added this to the path:
C:\Windows\System32
but I still get the error above
ok, that was the solution:
the problem was:
Error: spawn powershell ENOENT
so I need to add:
C:\Windows\System32\WindowsPowerShell\v1.0
to the path.
I openned Windows PowerShell as admin and run:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
run npm start again in the cmd and then metro boundler was openned
I did that commands yesterday but somehow it didnt work, guess I have missed something.
The full explanation can be found here:
https://www.youtube.com/watch?reload=9&v=nfX7HtNiCZI

How to fix "Invalid regular expression" in react-native?

E:\React-Native\reactnativeapp>npm start
I passed this command for compile my project in VS code via NPM command but last time its gave me error.
> # start E:\React-Native\reactnativeapp
> expo start
Starting project at E:\React-Native\reactnativeapp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression:
/(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
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\Ashish\AppData\Roaming\npm-cache\_logs\2019-11-08T06_13_41_377Z-debug.log

How to fix react native expo starting code?

When I type the normal expo code and start my project, I get the following error:
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git#github.com/expo/react-native-maps.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git 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\Atharva Sawant\AppData\Roaming\npm-cache\_logs\2019-03-27T17_07_14_954Z-debug.log
Process exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
I searched for errors and found a solution.
I drew up the answer by referring to the link.
I was able to get it to work by first installing Git for Windows as mentioned earlier https://git-for-windows.github.io/.
Then, instead of opening up a regular command prompt and issuing the apm install command, go to your Windows Start menu and open up Git CMD. Run the command there and it should work.
or
you try add GIT to $PATH
If you can't use Set, try adding it using Setx.
Syntax example is:
setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" /M
If you have any further questions, please leave a comment.

Npm doesn't work because of PyCharm

I have a strange error when I try to run an npm start
Here it is:
teddy#***:~/***$ npm start
> electron-quick-start#1.0.0 start /Users/teddy/***
> electron .
The file /Applications/PyCharm.app does not exist.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-quick-start#1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-quick-start#1.0.0 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! /Users/teddy/.npm/_logs/2018-03-25T09_57_37_106Z-debug.log
I removed pycharm because the script launched pycharm instead of executing the command line.
Can someone help me fixing this?
Thank you