Npm commands downloaded but not recognize - node.js

So I recently update node js pretty much since I was gonna try Angular but now when I try to run any command like create-react-app appname I start to get this.
C:\Users\Mine\AppData\Roaming\npm/node_modules/node/bin/node: line 1:
This: command not found
now I checked my Environmental variables and on top of my Path folder I have
C:\Users\Mine\AppData\Roaming\npm which im pretty sure is the correct
path.
I've tried to change the path to programfiles\node and it did not work as well.

i think you should after update node js uninstall create-react-app
npm uninstall create-react-app
npm uninstall -g create-react-app
npm cache clean --force
at the next
npm install -g create-react-app
Once installation successful, try running
npx create-react-app hello-world
Note
npx on the first line is not a typo — it’s a package runner tool that
comes with npm 5.2+.

Related

Why create-react-app don't create the body of the app?

I wanted to create a react application using npx create-react-app my-app, it runs and create a folder with node_modules, package.json and yarn.lock without the src and the public folder and it returns a template was not provided, this is likely you're using an outdated version of create-react-app like y'all seeing in the screenshots.
node v16.15.1, npm v7.24.2
this this commands i used
and this is the final result
Have you tried the command that is written in the last line: npm uninstall -g create-react-app? And then try again with npx create-react-app my-app
I finally figured out the solution for this.
I just needed to delete create-react-app folder in the node_modules because the uninstall command didn't work and run this command
npm install create-react-app#latest
then the problem is solved.

React Js, Template Not Provided On npx create-react-app <app name>

I'm starting a new react app using the
npx create-react-app <app name>
and am recieving an error of a template was not provided do the following ->
npx uninstall -g create-react-app
Well, I have done it and it hasn't helped. I've tried updating the current nodejs and npm versions, I've done a fresh install of nodejs, and I've cleared the npm and npx caches. I've also tried using specific create-react-app versions such as
npx create-react-app#latest(or some other version)
Nothing works, no template is ever provided, and I'm a little lost. Does anyone know another potential workaround? I'm open to manually downloading a folder containing the npx create-react-app post-completion contents if such a thing exists.
The React docs point out that you may have create-react-app installed via Yarn instead of NPM, and can try this also:
yarn global remove create-react-app
This SO answer suggests that if the npm uninstall -g create-react-app doesn't work, you can manually look to see if and where create-react-app may be installed.
If npm uninstall -g create-react-app stated above does not work. Type which create-react-app to know where it is installed. Mine was installed in /usr/bin folder. Then do sudo rm -rf /usr/bin/create-react-app.
Are you on Windows or Mac/Linux? The which command works on Mac/Linux, but not on Windows. I don't know the best way to do this on Windows, but this thread has some suggestions for PowerShell.
My understanding of the npx command is that it psuedo-installs the package (in this case, create-react-app) to ensure that we're using the latest available. It's convenient and recommended, but it isn't required. If you continue having issues, I would personally try fully installing create-react-app to see if I can scaffold a new project that way:
npm install -g create-react-app
create-react-app my-app

I can't create a template using create-react-app. getting the error message: a template was not provided. or ERROR 404

It's been many days that I am completely stuck and not able to create a react app with npx create-react-app my-app. I went through many Stakeoverflow conversations and tried in different ways but I keep on getting error messages : erro404 or error code1 or a template was not provided, and never succeed to create a template.
I've uninstalled and reinstalled Node version 16.13.1, my npm version is 8.1.2. 
I've tried : 
npm uninstall -g create-react-app 
npm install -g create-react-app
npm cache clean
npm rebuild
npm cache clean --force
npx clear-npx-cache
npm audit npm audit fix
npx create-react-app my-app --template[template-name]
npm config set registry http://registry.npmjs.org 
sudo npm i -g create-react-app
I also checked the npm status on  https://status.npmjs.org/ and everything looks normal .
I don't know what else to try.
Do you have any idea of how I can fix it?
I think you misread the syntax for the command line arguments. From CRA:
You can now optionally start a new app from a template by appending --template [template-name] to the creation command.

when i try to create react app ,i get " template was not provided ,This is likely because you're using an outdated version of create-react-app " Error

when i try to install react app with following code
npx create-react-app app1
i get following problem
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again.
i tried npm uninstall -g create-react-app and still it gives the same error , i don't know where the issue lies.
my system info
os : Windows 10 64 bit
nodeJs : v14.15.0
npm : v6.14.8
is this a problem with the node version..? How to solve the issues
Try to remove create-react-app from node_modules from user root
and npx create-react-app myapp should work.
or
npx --ignore-existing create-react-app
I searched for create-react-app on my whole mac through finder and deleted that folder. Then it worked
Make sure that there is no file named create-react-app anywhere:
You can use: where create-react-app in windows to locate it, if that doesn't work, search for it in the file explorer and delete it, that worked for me
Implement the following steps:
Write this code into your editor:
npm install --global yarn
And then upgrade:
yarn global upgrade
Create your app. You can choose your app name:
yarn create react-app your-app-name
Go to your app directory:
cd your-app-name
Delete the folder with the title create-react-app from your machine then
npx create-react-app my-app
this must fix your problem...

Create-React-App does not create starter template

I'm trying to create a new project with the typescript template as per these instructions.
npx create-react-app app-ui --template typescript
Although it installs all the node modules it does not create the starter project nor does it use the provided template. I get this message:
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
I'm attempting to follow the instructions and delete the global install of the cli but that also doesn't work:
npm uninstall -g create-react-app
up to date in 0.037s
No matter what I do I cannot uninstall the cli. What is going on?
Edit:
I was able to get it partially working on PC.
npm remove create-react-app
then
npx create-react-app my-app [--template typescript]
I tried with brackets and although the template project is there it isn't in typescript. There's something very wrong with the cli right now.
Edit:
This post solved the issue of not being able to uninstall the cli. Hope this helps someone and please upvote the OP.
For OP:
Your brackets are out of place.
For your case, the documentation docs says to use:
npx create-react-app my-app --template [template-name]
or
npx create-react-app my-app --template typescript
For everyone else:
Uninstall (I'm on Linux/Ubuntu)
sudo npm uninstall -g create-react-app
Then run:
npx create-react-app my-app
Note: Be sure that all the folders/files were removed on the uninstall. If you're having trouble accessing a the react folders in your linux setup as I was (due to permissions), gain access and remove by:
sudo chown -R $USER /usr/bin/create-react-app
(...and then do the npx command.)
I resolved this issue by sudo npm uninstall -g create-react-app
but this did not remove create-react-app, so I had to check in which directory it is located. In the terminal, if you type:
which create-react-app
it will give you some directory like /usr/local/bin/create-react-app
Now do:
rm -rf /usr/local/bin/create-react-app
This will remove create-react-app manually. Now you can start creating react app using
npx create-react-app my-app
I was having the same problem. This works for me (Linux)
Step 01.
sudo npm remove create-react-app
Step 02.
sudo npm uninstall -g create-react-app
Step 03.
npx create-react-app my-app --template typescript
I hope this helps.
Create React Startup template
1.npx create-react-app your_app_name
2.cd your_app_name
3.npm start
Even if you ran npm uninstall -g create-react-app create-react-app may still be installed. You can check by running which create-react-app. If a path is returned create-react-app is still installed. You can delete the module with rm -r ${returned path}. After that running npx create-react-app app-ui --template typescript should work without errors or warnings.
I came up with 3 solutions which I applied step by step when I faced this situation.
First step: From Official manual,
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.
https://create-react-app.dev/docs/getting-started
You can use these commands below:
npx create-react-app my-app
npm init react-app my-app
yarn create react-app my-app
Second step (If first one doesn't work):
Sometimes it may keep caches.then you can use these commands given below.
npm uninstall -g create-react-app
npm cache clean --force
npm cache verify
yarn create react-app my-app
Third step:(If these 2 won't work)
first uninstall via npm uninstall -g create-react-app,then check if you still have it "installed" with which create-react-app command on your command line. If you got something like (/usr/local/bin/create-react-app) then run this rm -rf /usr/local/bin/create-react-app (folder may vary) to delete manually.
Then again install it via npx/npm/yarn.
NB: I succeed in the last step.
When i executed
create-react-app hello
only generated below folder structure, with notification
"A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported."
node_modules
package.json
yarn.lock
Followed below steps to resolved
// Uninstalling create-react-app package
npm uninstall -g create-react-app
After that i am ready to create new react app through "npx"
For ES6 flavour (Default it will take ES6 language)
npx create-react-app hello-world
For Typescript flavour
npx create-react-app hello-world --template typescript
Following are the folder structure after running above cmd
README.md
node_modules
package.json
public
src
yarn.lock
yarn start //Works fine
node: v10.16.0
npm: 6.10.2
My solution ended up being a little different than yours so I will add it here just in case someone has a similar issue. Apparently I installed create-react-app globally with yarn which I could see when I ran which create-react-app which resulted in a path like .../.config/yarn/global/node_modules/.bin/create-react-app. Running yarn global remove create-react-app removed this package and then I was able to run npx create-react-app app --template typescript successfully.
Install create-react-app
In the beginning, we have to install create-react-app tool. It’s a tool provided by React.js creators, which allows installing ready to use React.js application, with all needed dependencies. To install the tool, we have to use the following command in the command line:
npm install -g create-react-app
Create the application
Now, it’s super easy to create our first application using the create-react-app tool. We can do it with a single command in our command line. First, navigate to the folder where you want to have your application through the command line, and then run the following command, where reactapp is the name of our application:
npx create-react-app reactapp
You can feel free to set a different name for your application. If the process finished successful, you should have your folder with the app ready! Let’s start the application now!
Start the application
Let’s start our reactapp with the following commands:
cd reactapp
npm start
The first command is used to enter the folder of our application, and the second one starts our app. By default, the application is open at localhost:3000, but we can change the port in the settings.
Link: https://dev.to/duomly/how-to-create-the-react-app-in-5-minutes-1bmb
Hpe this helps!
For Windows users, follow two steps
npm uninstall -g create-react-app
Then
npx create-react-app jamming
keep updating your node and npm, latest stable version
Uninstall create-react-app using command:
sudo npm uninstall -g create-react-app
Since npm is not supporting global use of npm modules.
install create-react-app boiler-plate as usual using command:
npx create-react-app my-app
it works!!
I faced the same problem using Command Prompt in Windows, but then I tried the following steps on Powershell it worked. If still it is not working then Run Powershell as Administrator.
npx create-react-app my-app
cd my-app
npm start
I was having the same problem. I tried this
npm install -g create-react-app
Then do the create-react-app app-name It worked out for me.

Resources