npm error while installing package in reactjs - reactjs

When I try to install any npm package, I get the following error. And the installation gets stuck.
I've pasted the error below
Error msg:
This version of npm is compatible with lockfileVersion#1, but package-lock.json was generated for lockfileVersion#2. I'll try to do my best with it!
Help me to solve this problem. Thanks in Advance.

The error message you mentioned is due to the fact that you are running an older version of npm. You are probably on v5 or v6 while your package-lock.json was generated with v7+.
However, that message is usually a warning, and not a final error. Would double check to see if you have other error messages as well.
More details for package-lock.json versions at: https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion

Related

Can't resolve 'react-motion'

I am having troubles on runnning a code online, it's the sliding image puzzle from this link: https://www.youtube.com/watch?v=_wdbhVvMOCs and here is the github from the video's description: https://github.com/danba340/react-sliding-puzzle
If I type in npm start, it shows
this error on the local host.
After running it on the VS Code, it shows
this error that says \node_modules\react-motion doesn't exist.
Whenever I try npm install --save react-motion , it shows
this error on the Visual Studio Code.
Please help me this is for my project thank you!
The reason is because the library doesn’t support react 17 yet.
Try by reinstalling your modules from scratch with the following:
rm -rf node_modules package-lock.json; npm i; npm i react-motion
If that doesn’t work, you’ll need to force the installation:
npm i react-motion —-legacy-peer-deps
If the library still have problems, you’ll then need to downgrade react to version 16 instead of 17 to make it work.
Last but not least, if you don’t want to downgrade, you can try to do the same by using yarn instead of npm

Error while running ‘hello-react’ program in react.js

With lots of issues while installing react.js finally when I thought that issues were resolved and everything is in a good place. I found this as a heartache issue.
Error description Image for reference:
Whenever you see this error, it means that something went wrong when you installed the dependencies.
The proper method to fix this error and install all the dependencies again can be found in this answer.
A quick workaround can be to install this specific dependency again using the following npm command:
npm intall react-scripts start
This will help you solve this issue. I still recommend you to install all the dependencies again so that you won't run into such issues later on.
Please mark this answer as accepted if it solves your issue.
Please execute the below-mentioned command.
npx i -g create-react-app
It takes few minutes and displays a message similar to below
We suggest that you begin by typing:
cd your-app-name
yarn start
Happy hacking!
cd into the your-app-name folder and execute npm start
Additional Reference: https://reactjs.org/docs/create-a-new-react-app.html

Why there occurs an error while I tried to install packages using npm

I am working in react js . While installing packages I got the following error as shown in the image. I tried many ways but nothing becomes right. How can I solve this issue?IMAGE OF ERROR
you havn't installed python yet
So install python !
Still problem persist then try
npm cache clean --force

React or NPM issue?

Good Evening All! Hope today was great coding day for everyone. Quick question..
After running the “npx create-react-app” command I get the following error message in my terminal
Cannot find module ‘./internal/Observable’ Require stack:
/Users/FInnocent/node_modules/rxjs/index.js
/Users/FInnocent/node_modules/inquirer/lib/ui/prompt.js
/Users/FInnocent/node_modules/inquirer/lib/inquirer.js
/Users/FInnocent/node_modules/create-react-app/createReactApp.js
/Users/FInnocent/node_modules/create-react-app/index.js
I’m running version v12.16.2 of node and 6.14.4 of npm.
I’ve tried searching for this error in StackOverlow but no luck. I also tried to install this module by running
npm install ./internal/Observable” and get the following error:
npm ERR! Could not install from “internal/Observable” as it does not contain a package.json file.
Any ideas on what’s wrong and how I can fix it?
Found a solution actually, I ran the following
npm install rxjs
And i’m all set now

Unexpected error using create-react-native-app:

Attempting to use create-react-native-app and falling at the first hurdle here.
I think the problem is when Yarn attempts to install dependencies:
yarn install v0.27.5
[1/4] Resolving packages...
warning react-native > connect#2.30.2: connect 2.x series is deprecated
error An unexpected error occurred: "https://raw.githubusercontent.com/expo/node-websql/e364fa65146a9e2157a19e5c719e7702c2b6b87a/package.json: connect ETIMEDOUT 90.207.238.183:443".
info If you think this is a bug, please open a bug report with the information provided in "D:\\users\\jamie\\WebstormProjects\\hang\\hang-app\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Failed to install
What's odd is that I ran create-react-native-app on this machine last week to test it out and everything was fine.
Does anyone have any idea about what might be going on here?
The error message says towards the end of the 4th line: connect ETIMEDOUT, which I assume means that Yarn timed out while downloaded that package.json file.
I just tried pasting the URL in my browser and it loaded, so if you try again it might just work!

Resources