Alternative on "npm run eject" - npm

Will a ReactJS app project be ended when I simply close the CLI, while in first instance the Node.js Package Manager was running the developer server through the "npm start"-command in the CLI? Or will the ReactJS app project run in the background?
If the second question is true, how can I otherwise stop the ReactJS app project without having to worry that I have to run "npm run eject" in the CLI and never being able to run the ReactJS app project in the development stage? The following occurs when I do so (run "npm run eject" in the CLI) for the second time:
npm ERR! path C:\Users\1st assembled M-PC\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\1st assembled M-PC\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\1st assembled M-PC\AppData\Roaming\npm-cache\_logs\2018-04-27T17_27_41_529Z-debug.log

If your app is running simply press Control + C to halt it. Closing the Command Prompt will achieve the same result. You will still be able to run it again with npm run start after this.
A note on ejecting – to successfully eject you need to run npm run eject from your project folder. However this operation is usually needed only if you are a power user and you aren't happy with the default configuration.

Related

Unable to update or execute the 'expo' command in command prompt

For the first time i tried to install the expo-cli on my project directory it worked. I can use expo init to make my first react native app in my command prompt, and run the app with expo start. But now when i have some new project to make with the 'expo' command like expo init or expo start or something else, it didn't work anymore. When i tried to type and enter the expo command, its always be
'expo' is not recognized as an internal or external command, operable program or batch file.
And now when i tried to update the expo-cli with npm install -g expo-cli a warning of error appeared.
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli
npm ERR! dest C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w'
npm ERR! [Error: EPERM: operation not permitted, rename 'C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli' -> 'C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\ACER\\AppData\\Roaming\\npm\\node_modules\\expo-cli',
npm ERR! dest: 'C:\\Users\\ACER\\AppData\\Roaming\\npm\\node_modules\\.expo-cli-foqoNR8w'
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\ACER\AppData\Local\npm-cache\_logs\2021-01-10T17_18_03_575Z-debug.log
This preventing me from doing the installation of react navigation and make a new project by using 'expo' command. And i've been search this problem on and tried to solve it but it didn't work on any various ways that i've tried. I've tried to reinstall the expo-cli but it didn't work, i've tried to use yarn as well but still it didn't work. I've been re-added the path for the npm and even tried to reinstall nodejs and use any various code for updating and installing the 'expo-cli' but it didn't work as expected.
Any suggest on how do i can fix this problem ?
Run your command line as Admin and then do the following:
npm remove -g expo-cli to remove the existing CLI
and then npm i -g expo-cli to reinstall the Expo CLI.
Then you can simply login via expo login (if you were logged in) and take off from where you were!
I delete the expo file on the path :
C:\Users\ACER\AppData\Roaming\npm\node_modules\expo-cli
C:\Users\ACER\AppData\Roaming\npm\node_modules\.expo-cli-foqoNR8w
the file that i deleted : expo-cli & .expo-cli-foqoNR8w
And then try to install the expo-cli again with npm install --global expo-cli then it work. Now i can use my expo start or whatever code with 'expo' in it. And also now i can install react navigation on my project directory. And i'm running the installation by using command prompt run as admin.

NPM Error code when trying to run npm start

I keep getting the npm ENOENT error when I try to run npm start. I'm not sure what to do to fix this issue.
I have tried to change permissions for folders.
bryantcaruthers-> npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/bryantcaruthers/workshop-vs-code-can-do-that/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/bryantcaruthers/workshop-vs-code-can-do-that/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! /Users/bryantcaruthers/.npm/_logs/2019-11-06T03_31_38_233Z-debug.log
Be able to run npm start with no errors.
The error is that there is no package.json file in the directory you are running the code in:
no such file or directory, open /Users/bryantcaruthers/workshop-vs-code-can-do-that/package.json
Are you expecting a package.json file in that directory? Or should you be running npm start from somewhere else?
You can resolve that issue by following methods:
Ensure dependencies described correctly on package.json
Just run
npm install
Check issue still exists. and If issue not resolved, continue these methods.
npm cache clean
sudo npm install -g npm
npm cache clean
npm install
I found solution to this error. This error mostly occurs because you are not working on the right folder, cd to the right folder where you installed the npm or you can open the folder with vs code. For example, you have a main folder that contains the site or app folder, you need to be working from the subfolder and not the main folder, this is where you installed the npm and the dependencies are described correctly on package.json.
Your project workshop-vs-code-can-do-that does not have a packeage.json file available, to create it, go to terminal (on your project path), run this command
npm init -y
Encountered the same error.
Root Cause:
Not installing(npm i) and starting(npm start) from the correct path in terminal
Solution:
Change the directory to the application directory where package.json
present
hope this might help, Thanks.

Cannot start Electron application - missing package.json

I'm currently doing a Python project where I want to display my results in an Electron application. I have seen a demo video on YouTube on how to set up Electron on a Mac. The video showed 3 simple steps to be executed in the terminal:
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install && npm start
When I first ran the above commands it worked fine for me. I was able to start the Electron application.
But when I tried to re-start the application using the command npm start after going into the electron-quick-start directory, I am not able to open the application.
I am continuously getting an error message as follows:
(base) Viveks-MacBook-Pro:electron-quick-start vivekchowdary$ npm start
npm ERR! path /Users/vivekchowdary/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/vivekchowdary/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! /Users/vivekchowdary/.npm/_logs/2019-04-19T12_55_01_157Z-debug.log
(base) Viveks-MacBook-Pro:electron-quick-start vivekchowdary$
I don't know what it means? But I just want to open the Electron application.
As the error message states, the file package.json cannot be found.
One possible reason is that the terminal is not in the correct project folder and that you need to cd into the folder before running npm start.
If you cd to any folder that has no package.json (and whose parent folders don't have a package.json) and run npm start, you'll be presented with this error message.
Your specific file path seems to indicate that you ran npm start from your home folder, not the project folder that contains package.json.
I got a similar issue and I fixed it by creating the files it was asking for as well as a basic package.json file that my compiler generated for me

How can i run a demo React Native Code on Phone

Im totally new to React Native and just learned to setup the necessary environments and follow these steps;
Install Node.js
Download Expo client at mobile device
npm install -g create-react-native-app
cd to my desired directory
create-react-native-app some_app_name
cd to my app folder containing default app.js
npm start
basic / empty app will be loaded on my phone and code can be opened using editor of choice.
Now i've downloaded some demo simple apps from github and udemy (with full source code)
I tried to extract the files and cd to the folder and execute "npm start"
However, there is always this error
react-native-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! demo_app#0.1.0 start: react-native-scripts start
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the demo_app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
May i know what is missing? How do i get this right?
The command to run a react-native app is react-native run-android for android devices and react-native run-ios for ios devices. Are you sure that you are running these commands to start the app?
Seems like this might be a duplicate of:
sh: react-scripts: command not found after running npm start

After running command "npm i" I started getting multiple error

I am facing this issue after I ran npm i command by following THIS THREAD. Now when I am trying to install various dependency for my project, I am getting bunch of errors:
λ npm install -g
npm WARN
D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules\lodash
is not a child of C:\Users\xxxxx\AppData\Roaming\npm
npm ERR! path
D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules\lodash
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename
'D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules\lodash'
-> 'D:\ITC\node_modules\#microsoft\sp-lodash-subset\node_modules.lodash.DELETE'
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\xxxxx\AppData\Roaming\npm-cache_logs\2017-07-26T12_26_10_273Z-debug.log
This is a common issue in the new version of npm. It has been brought to their attention. I believe you can fix the issue by creating a new root directory for your project and paste everything but your node_modules folder in it. Then try npm install
your path might be incorrect...
go to your directory and press right click with shift and select command prompt then execute your command...
I faced the same issue with npm. In my situation I had the project folder on Github. Please delete the local copy of the project folder entirely. Clone the project again to local and run the npm i command inside the project directory.
I am assuming you are trying to install the packages installed in dependencies mentioned in package.json.
I used VSCode in administrator mode,
have windows 10 :build 19041.508 and
Using WSL 2.0.