npx react-native init AwesomeProject error enolocal - node.js

i got an error while trying to create react native app using npx npx
react-native init AwesomeProject
like the docs said. But i got an error messages
npm ERR! code ENOLOCAL npm ERR! Could not install from
"Indigo\AppData\Roaming\npm-cache_npx\3192" as it does not contain a
package.json file.
npm ERR! A complete log of this run can be found in:
C:\Users\Durio
Indigo\AppData\Roaming\npm-cache_logs\2020-07-08T08_20_54_191Z-debug.log
Install for react-native#latest failed with code 1
i know it's not from the npx because i tried to create react app with npx and it works. Am I the only one who had this?

This is an issue in node which is caused by white space in user name between first-name and last-name in windows.
run the following command after replacing firstname with your windows user firstname in command prompt with administrator access
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global

I had you try npm cache clear and if using windows you can run command npx react-native init AwesomeProject in Command promt using Run as Administrator

I have faced the same issue, do nothing just a quick fix.
first, run the command npm i react-native#latest -g then create your project with your command i.e npx react-native init myProject

we should check the android SDK path on environment variable. Make sure there is no white space on the SDK path and platform-tools path

Related

npm and other modules commands not working

Note: I am on Windows 10 64 bit running the latest LTS Node build.
It all started when I tried running the command npm i -g create-react-app and I get a message saying that npm is not a command.
I checked my PATH and I believe I have the proper directories in there.
I navigated to the directory of npm and tried running the command again, but it still didn't work. I found that the command npm.cmd worked in any directory. So tried running npm.cmd i -g create-react-app and that worked! I also had to use the the command create-react-app.cmd my-app, instead of create-react-app my-app. I thought I was set and I could just use those .cmd commands for the things I needed to do; however, when I tried to run the command create-react-app.cmd my-app and got this as a result:
I have looked in the file that is ran when using this command create-react-app.cmd my-app and there is no sign of npm being called. Turns out Node is being called in that file with the command below. I know this because when I run it by itself and I get the same output to the console seen in the previous image.
"node" "C:\Users\Allen\AppData\Roaming\npm\\node_modules\create-react-app\index.js" my-app
it was called in the create-react-app.cmd file like this "%_prog%" "%dp0%\node_modules\create-react-app\index.js" %*
I am at a loss. I could continue down this rabbit hole and try and find the node file that is calling npm and change it to npm.cmd but I would rather find a way to get the npm and create-react-app commands working as they are suppose to. At the very least I can just spin up a VM and work in that. It is just annoying that I can't get Node to work properly for me.
Use the command npx create-react-app my-app this will help you create react projects.
Also check the documentation : https://reactjs.org/
First check that you have npm installed on your machine and the version. You can just type npm version. Since npm version 5.2.0 npx is pre-bundled with npm, which is a CLI tool whose purpose is to make it easy to install and manage dependencies hosted in the npm registry. So try using npx create-react-app app-name. You can confirm that you are able to use npx by running which npx. If it is not available then you can install it by running npm install -g npx.

How do I resolve the operation not permitted error while attempting to install react?

I'm running the latest version of Node.js, I have been using it for a few weeks now. So the next module in the web dev Bootcamp is to learn React.
I used the suggested command: npx create-react-app my-app
however, I got this error:
Error: EPERM: operation not permitted, mkdir 'C:\Users\JIREHGIBSON'
command not found: create-react-app
Im using a windows PC, and did not have any issues using npm until when I tried to use react locally.
I have tried to install using a sudo line command, I have edited the configuration to get rid of the space in the user name, and i have tried a force command to clear the shell cache.
Help!
You have 2 way to resolve this:
npm cache clean
Or
Did a search for .npmrc file, and changed prefix= to the correct user.
Or
npm install -g create-react-app
npx create-react-app my-app
Or
running cmd through administrator.

Npm start doesnt work after I create a react app

I'm following a youtube react tutorial and what I did was npx create-react-app my-app Once this was done I cd'ed into my-app and tried to npm start like the tutorial showed. I got an error saying
-npm ERR! missing script: start
I also saw that the person in the tutorial had a public and a source folder. I only have the node_modules folder and package-lock.json and package.json. Why am I missing the public and source folders and why cant I npm start?
I had the same issue and solved it running : npm uninstall -g create-react-app.
Thanks to the -g (aka 'global' attribute) you can run this terminal command no matter the directory you find yourself.
Then go in the directory you would like to find your project and run npx create-react-app my-app again!

npm ERR! code ENOLOCAL npm ERR! Could not install from "Ibrahi\AppData\Roaming\npm-cache\_npx\8992" as it does not contain a package.json file

I'm sitting my react environment and I get this error.
New react installation. npm --version is running correctly but still :
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Ibrahi\AppData\Roaming\npm-cache_npx\8992" as it does not contain a package.json file.
How do I fix this?
I faced same issue, problem was due to space in my user name i.e. FirstName LastName and issue is with npx. I applied following fix and everything worked just fine
npm config set cache C:\tmp\nodejs\npm-cache --global
Source: https://github.com/zkat/npx/issues/146
Many thanks to Bhupender for providing the github link!
A summary of the best answers there, for those, like me, coming late to the party:
Find the windows short name for your user directory...
cd C:\Users
dir /x
Then edit the npm cache location to use the windows short name.
e.g. "C:\Users\HP User" is also "C:\Users\HPUSER~1" so the following command resolves the problem...
npm config set cache "C:\Users\HPUSER~1\AppData\Roaming\npm-cache" --global
This has the advantage of avoiding having to install create react app locally.
Late to the party but I was also facing the same issue so what I did is
Step 1:
Open the Terminal as an Admin and run the following command first
npm install -g create-react-app to get around the npx issue.
After step 1 run this command:- npx create-react-app my-first-app
hope so it'll help you.
This happens when you have a space in your path. To fix it follow these steps:
run npm config edit
go to line where cache is: ; cache = 'C:\Users\FIRSTNAME LASTNAME\AppData\Roaming\npm-cache'
replace the space between firstname and lastname with ~1
remove ; at the beginning of the line
run yarn
Just to make sure you've got it, the line should look like this:
cache = 'C:\Users\FIRSTNAME~1LASTNAME\AppData\Roaming\npm-cache
Follow these steps to solve the problem:
run npm config edit command, then edit the line number 37.
Remove the coma(;) at the begining of the line and the space between
Luxis and computers:
From this: ; cache=C:\Users\Luxis
Computers\AppData\Roaming\npm-cache)
To this: cache=C:\Users\LuxisComputers\AppData\Roaming\npm-cache
I also had this issue, and here is what worked for me.
I installed create-react-app, first using the command:
npm install -g create-react-app
Then i created the react Application using:
npx create-react-app myfirstreact
Use this code in your CMD
npm config set cache C:\tmp\nodejs\npm-cache --global
https://github.com/zkat/npx/issues/146
Simply, run:
npm config set cache "C:\Users\Omar\AppData\Roaming\npm-cache"
Instead of Omar write the first name of your user's folder (in my case the folder name is Omar Sabri).
Run the following command issue will be sorted out.
It is due to space in the User Name.
npm config set cache "C:\Users\FirstName\AppData\Roaming\npm-cache"

Installing Angular CLI with npm install fails

I am new to AngularJS, just started an online course.
I am trying to install angular CLI on my computer at work running Windows 7.
I opened command line as administrator and running npm install -g #angular/cli. Installation starts and after a few minutes I get an error:
I see the notification "operation not permitted", but I am the administrator of the computer and the command line I run as administrator.
What am I doing wrong?
The same installation I did on my laptop at home and it was successful.
I am checking with our IT support about other possible causes and will appreciate any help.
This is not a duplicate of Fail to install npm package “npm ERR! errno -4048” or npm install -g angular-cli fails.
Ignoring the error and running gn -v I get the following:
Is this correct? Was Angular CLI installed?
These issues are because of the company proxy settings.
Check with your admin to get the proxy for http or https.
It will be something like this:
http_proxy = http://http.myproxy.com:8000
https_proxy = http://http.myproxy.com:8000
Replace myproxy with the name of company proxy.
Then go to the command prompt and run the following command to set the proxy. Later you can run any command like npm install -g #angular/cli to run. It will work
npm config set proxy http://http.myproxy.com:8000
npm config set https-proxy http://http.myproxy.com:8000
That fsevents library has peculiarities on Windows. So I suggest you ignore the error message and run ng -v from the command prompt to confirm you got the Angular CLI libraries installed.
You need to run the npm commands on node.js command prompt but not on windows command line.
Workaround: install git bash on windows.
As the error message suggest, you don't have some permissions to execute your command.
Depending on your system, you should run the command as an administrator.
Also, don't mix AngularJS (the first Angular framework) and Angular (also known as Angular 2, 4 and 5 now) . They are radically different in their syntax and uses.
Run below command and try installing angular cli again.
npm cache clean -f
This worked for me manytimes.

Resources