I'm having a hard time running a react command - reactjs

I just updated my npm and got rid of some useless packages, but for some reason, I still am running into some weirdness when trying to run this command
kalebamarante$ npm init create-react-app kalebcryptoexchange-app
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/create-create-react-app - Not found
npm ERR! 404
npm ERR! 404 'create-create-react-app#latest' is not in the npm 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! /Users/kalebamarante/.npm/_logs/2021-03-09T00_18_58_939Z-debug.log
KALEBS-MacBook-Pro:~ kalebamarante$ npx create-react-app kalebcryptoexchange-app
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.3).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
npm ERR! code 1
npm ERR! path /Users/kalebamarante
npm ERR! command failed
npm ERR! command sh -c create-react-app kalebcryptoexchange-app
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kalebamarante/.npm/_logs/2021-03-09T00_20_01_995Z-debug.log
KALEBS-MacBook-Pro:~ kalebamarante$ sh -c create-react-app kalebcryptoexchange-app
kalebcryptoexchange-app: create-react-app: command not found

you should try npx instead of npm init.
npx create-react-app kalebcryptoexchange-app.

You should use npx instead of npm.
npx create-react-app your-app
Now why is that?
When you are using npm command it will get the node packages for you. i.e. You may have installed the package called 'create-react-app' globally using npm. Now to execute that package you have to use npx command.
Your error log shows this line,
npm ERR! 404 'create-create-react-app#latest' is not in the npm registry.
because you are trying to fetch a package instead of creating it using create-react-app.
In short, npm downloads the packages, npx execute a package.

Related

How can i solve NPM err when i get the npm ERR! code E404

I have just created a new laravel application to implement a chat app.
I wanted to scallfold the application using bootstrap but am getting this error :
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/33998 - Not found
npm ERR! 404
npm ERR! 404 '33998#*' is not in this registry.
npm ERR! 404
How can i solve it?
I tried running composer update to see if im missing some dependencies.
I was wrong.
I also runnpm install && npm run devit still did not work
Try to run these commands:
npm config set registry http://registry.npmjs.org
npm -g install npm
npm cache clean -f
After that try to run your project with:
npm run dev
This error is just because of the package 33998 could not be found in the npm registry.
For solution you need to install bootstrap package in your application manually.
For installing BootStrap Use
npm install bootstrap
Also clean the cache of npm forcefully by
npm cache clean --force
Also check the latest npm version and update it if it was to old.
npm -v
npm install -g npm

Error with terminal when trying to create-react-app

I'm trying to create a new react app, but I can't seem to do it. I have searched everywhere and done everything I could that can be done nothing is working. I have deleted node, npm, and npx two times and downloaded again, and then restarting my computer like 100 times but nothing works:
Need to install the following packages:
create-react-app
Ok to proceed? (y)
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
my#mycomp-MacBook-Pro ~ % npm uninstall -g create-react-app
up to date, audited 1 package in 176ms
found 0 vulnerabilities
my#mycomp-MacBook-Pro ~ % npx create-react-app my-app
Need to install the following packages:
create-react-app
Ok to proceed? (y)
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
my#mycomp-MacBook-Pro ~ %
And after that if I try to npm uninstall -g create-react-app or anything else it alwayse send this error:
my#mycomp-MacBook-Pro ~ % npm uninstall npm uninstall -g create-react-app
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! dest /usr/local/lib/node_modules/.npm-i9nnxROI
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/npm',
npm ERR! dest: '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
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! /Users/mycomp/.npm/_logs/2021-12-15T12_37_53_679Z-debug.log
my#mycomp-MacBook-Pro ~ %
How can I fix this?
The problem seems to be that of an inappropriate installation. The go-to way to fix this would be to ensure a proper uninstall of node and npm. Please follow the steps mentioned here. Once properly uninstalled, head over to install node and proceed with the re-installation.
First, remove the package. If you have installed create-react package using npm then use
- npm uninstall -g create-react-app
or if yarn
- yarn global remove create-react-app
Then you can create a project:
npx create-react-app my-app

could not create react project

I was trying to create a react project using the command
npx create-react-app chat-app
But I am getting this error.
Creating a new React app in /home/mikhil/react-tutorial/internshala-react-course/chat-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! npm ERR! Found: #babel/core#undefined
npm ERR! node_modules/#babel/core npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #babel/core#"^7.0.0-0" from #babel/preset-env#7.13.10
npm ERR! node_modules/#babel/preset-env
npm ERR! #babel/preset-env#"^7.12.1" from #svgr/webpack#5.5.0
npm ERR! node_modules/#svgr/webpack
npm ERR! #svgr/webpack#"5.5.0" from react-scripts#4.0.3
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"*" from the root project
npm ERR! npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/mikhil/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mikhil/.npm/_logs/2021-03-18T11_58_50_255Z-debug.log
Aborting installation. npm install --save --save-exact --loglevel
error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting chat-app/ from /home/mikhil/react-tutorial/internshala-react-course
Done.
You can try to update npm with npm update and see if that fixes it, and if not you can try these steps.
If you've previously installed create-react-app globally via npm install -g create-react-app, it is recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
You will also want to delete your remnant files and folders for chat-app
Once you are in the /home/mikhil/react-tutorial/internshala-react-course directory and you have removed the global installations you can try running these commands.
npx create-react-app my-app
cd my-app
npm start
Create React App - Getting Started
I was having the same issue with NPM version 7.20.0.
Simply install an older version of NPM.
In the terminal run: npm install npm#6.14.11 -g
There appears to be some particular versions of NPM that cause this issue. Try updating to the very latest version of NPM.
I was also trying to do the same the whole day, then at last I have to open the documentation, there it was mentioned that you can also create react app using
npm init create-react-app **app_name**
and it worked for me fine.
I was troubled very much by this dependency thing.

React-bootstrap not installing due to husky error

I am trying to install react-bootstrap.
Yesterday I managed to successfully install react-bootstrap but I then later uninstalled it. Today I tried to reinstall it in the same project but it gives me the bellow errors.
I then created a new react app as a test in order to try and install react-bootstrap, but it failed with the same errors.
It seems that there is an issue relating to husky, so I installed this package but that did not help either.
I am using macOS.
noahgwynn#Noah frontend % npm i react-bootstrap
npm ERR! code 127
npm ERR! path /Users/noahgwynn/Documents/code/udemy-mern/frontend/node_modules/#popperjs/core
npm ERR! command failed
npm ERR! command sh -c husky install .config/husky
npm ERR! sh: husky: command not found
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/noahgwynn/.npm/_logs/2021-02-20T19_52_28_911Z-debug.log
noahgwynn#Noah frontend % npm install --save react-bootstrap
npm ERR! code 127
npm ERR! path /Users/noahgwynn/Documents/code/udemy-mern/frontend/node_modules/#popperjs/core
npm ERR! command failed
npm ERR! command sh -c husky install .config/husky
npm ERR! sh: husky: command not found
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/noahgwynn/.npm/_logs/2021-02-20T19_55_15_427Z-debug.log
noahgwynn#Noah frontend %
Your help is appreciated.
EDIT: Problem fixed!
Just tried "npm i react-bootstrap" again and this time it worked. It's a couple of hours later, not sure what changed but I'm happy it did.

Could not find a declaration file for module 'react-bootstrap-table-next'

I'm trying to run 'react-bootstrap-table-next' with my reactjs app. I'm having a problem
root#ubuntu:/home/rin/sc-deal/client# npm install #types/react-bootstrap-table-next
root#ubuntu:/home/rin/sc-deal/client# npm install #types/react-bootstrap-table-next
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#types%2freact-bootstrap-table-next - Not found
npm ERR! 404
npm ERR! 404 '#types/react-bootstrap-table-next#latest' is not in the npm 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! /root/.npm/_logs/2019-06-24T12_58_36_545Z-debug.log
root#ubuntu:/home/rin/sc-deal/client#
also error in my app because of it:
react-bootstrap-table-next doesn't exist in the #types scope.
You should instead use react-bootstrap-table.
npm install --save #types/react-bootstrap-table
I got the same issue in my project.
When I installed this package first time i used below command.
$ yarn add #types/react-bootstrap-table-next
It did not work. so i removed it and re-installed it with below command.
$ yarn add react-bootstrap-table-next #types/react-bootstrap-table-next
This worked fine for me. In my project i used typescript.
Refer this link also if it is useful: https://github.com/react-bootstrap-table/react-bootstrap-table2/issues/989

Resources