npm add react-icons installation does not work - reactjs

I am new to React and I try to download react-icons, but there is an error, which is different from those I had found here. Can you help, please?
(base) Jana-MacBook-Air:react_project jb$ npm install react-icons --save
Response:
npm WARN saveError ENOENT: no such file or directory, open '/Users/jb/Desktop/react_project/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/jb/Desktop/react_project/package.json'
npm WARN react-icons#4.1.0 requires a peer of react#* but none is installed. You must install peer dependencies yourself.
npm WARN react_project No description
npm WARN react_project No repository field.
npm WARN react_project No README data
npm WARN react_project No license field.
+ react-icons#4.1.0
updated 1 package and audited 1 package in 1.875s
found 0 vulnerabilities

Well, do you have a package.json file in your root path of the project? The error is because that package have a peer dependency with react and because it's not finding the package.json file, then for the npm installation process, react it's not installed.

Related

How can I install React using NPM?

I can't install react using npm for some reason, I can't figure out what the problem is. Does anyone know a solution to this problem? I uninstalled npm and tried again but it didn't help and tried other things. but it doesn't help me.
stalling react, react-dom, and react-scripts with cra-template...
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\darslar\imtihon-app\node_modules\tailwindcss\oxide-node-api-shim/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\darslar\imtihon-app\node_modules\tailwindcss\oxide-node-api-shim\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\User\AppData\Local\npm-cache\_logs\2023-02-08T15_57_28_764Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
node:fs:1226
return handleErrorFromBinding(ctx);
^
Error: EBUSY: resource busy or locked, rmdir '\\?\D:\darslar\imtihon-app'
at rmdirSync (node:fs:1226:10)
at _rmdirSync (node:internal/fs/rimraf:235:5)
at rimrafSync (node:internal/fs/rimraf:193:7)
at Object.rmSync (node:fs:1275:10)
at Object.removeSync (C:\Users\User\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\remove\index.js:15:28)
at C:\Users\User\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:539:14
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -4082,
syscall: 'rmdir',
code: 'EBUSY',
}
Node.js v18.12.0
Try these steps:
Delete package-lock.json and run NPM again.
Ensure no other processes of node.js are running (check task manager)
If you are using visual studio code, close it and try running npm install again.
You can also check the following issue page: https://github.com/npm/npm/issues/17444
https://github.com/tailwindlabs/tailwindcss/issues/10534#issuecomment-1422896616
Basically you need update npm to latest version
npm install -g npm#latest
Delete package-lock.json and node_modules and launch
npm i
It was a problem with dependency of cra. Whole world couldn`t install react for one hour.

Fix the upstream dependency conflict, react-share with React 18, Deployment failed in Netlify

Unable to install react-share on React 18 project and failed deployment on Netlify
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.3.0 || ^17" from react-share#4.4.0
npm install --save --legacy-peer-deps react-share
First, utilize the advised command npm install --save --legacy-peer-deps react-share
then, in your app root directory create a .npmrc file
lastly add to the file legacy-peer-deps=true
and you're ready to deploy.
The --legacy-peer-deps flag was introduced with v7 as a way to bypass peerDependency auto-installation; it tells NPM to ignore peer deps and proceed with the installation anyway.
npmrc is the configuration file that npm allows to be used globally or user level or project level to optimize your npm environment. npmrc can be configured in four different locations. Globally. Per user. Per project.

NPX create-react-app cannot find a matching version for #typescript-eslint/experimental-utils#2.19.1

I'm on a new computer and tried to run npx create-react-app myapp and I am receiving this error. Never had this before, it looks like it's missing the es-lint package?
$ npx create-react-app my-app
npx: installed 99 in 4.157s
Creating a new React app in C:\Users\Name\Documents\demos\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for #typescript-eslint/experimental-utils#2.19.1.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of '#typescript-eslint/eslint-plugin'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Name\AppData\Roaming\npm-cache\_logs\2020-02-10T19_41_06_770Z-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 my-app/ from C:\Users\Name\Documents\demos
Done.
Looks like this is now a known bug in the release of typescript-eslint version 2.19.1 a couple hours ago and they're working on fixing it at the moment:
https://github.com/typescript-eslint/typescript-eslint/issues/1588
UPDATE:
This was a problem with NPM - and there were likely other builds affected.
https://status.npmjs.org/incidents/1dpd0zjyhj2v
Either way, this has been resolved.

After npm install tachyons, tachyons package not added in package.json?

npm install output:
npm WARN afterxii#1.0.0 No description
npm WARN afterxii#1.0.0 No repository field.
+ tachyons#4.11.1
updated 1 package and audited 518 packages in 5.404s
found 0 vulnerabilities
How can it be added in package.json
You should include the command you're executing.
However, I assume that you executed npm install. To add a package to dependencies you should do npm install --save or npm install --save-dev.
More info in the documentation https://docs.npmjs.com/cli/install

Error Installing React

Whenever I do a npm init then npm install react - I get this error
── UNMET PEER DEPENDENCY react#15.3.0
npm WARN baobab-react#0.1.1 requires a peer of react#>=0.13.0 <1.0.0 but none was installed.
npm WARN fixed-data-table#0.4.7 requires a
peer of react#>=0.13.0 <0.15.0 || ^0.14.0-beta3 but none was
installed.
npm WARN react-native#0.30.0 requires a peer of
react#~15.2.0 but none was installed.
npm WARN react-router#0.13.5
requires a peer of react#0.13.x||0.14.x but none was installed. npm
ERR! code 1
This is my node v6.3.0 annd npm 3.10.3 versions.
npm install react --no-optional
Inside your project directory, can you please first run the following commands:-
1) rm -rf node_modules
2) Try installig react again now and other packages which are in your package.json file.

Resources