Any idea how to resolve this error? I get it when trying npm install:
npm ERR! Found: react#16.14.0
npm ERR! node_modules/react
npm ERR! react#"^16.14.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.1" from react-card-flip#1.1.0
npm ERR! node_modules/react-card-flip
npm ERR! react-card-flip#"^1.0.11" from the root project
The package.json has: "react-card-flip": "^1.0.11",
I removed the node_modules directory and the package-lock.json file.
I'm not sure where the reference to 1.1.0 is coming from. I DID try to install it earlier when trying to upgrade React 17, but ran into limitations with blueprintjs/core 3.39.0 requiring React 16.14.0.
Thanks for any ideas or help you can provide.
Full content of the package.json below in case that helps.
package.json content:
{
"files": [
"./LICENSE.md"
],
"name": "myproject",
"version": "0.1.0",
"private": true,
"dependencies": {
"#blueprintjs/core": "^3.39.0",
"#ckeditor/ckeditor5-build-classic": "^12.2.0",
"#ckeditor/ckeditor5-react": "^1.1.3",
"apexcharts": "^3.19.3",
"axios": "^0.21.1",
"bootstrap": "^3.4.1",
"cleave.js": "^1.5.2",
"country-state-city": "^1.0.0",
"fomantic-ui": "^2.8.7",
"moment": "^2.24.0",
"plaid": "^8.1.6",
"react": "^16.14.0",
"react-apexcharts": "^1.3.7",
"react-bootstrap": "^1.4.3",
"react-burger-menu": "^2.6.11",
"react-card-flip": "^1.0.11",
"react-dom": "^16.8.6",
"react-dropzone": "^10.1.4",
"react-google-login": "^5.1.21",
"react-grid-system": "^4.4.5",
"react-intl-universal": "^2.4.1",
"react-redux": "^6.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.4",
"react-scroll": "^1.7.14",
"react-select": "^2.4.4",
"react-share": "^3.0.0",
"react-signature-canvas": "^1.0.3",
"react-slick": "^0.24.0",
"react-star-ratings": "^2.3.0",
"react-stripe-elements": "^3.0.0",
"reactjs-popup": "^1.3.2",
"reactstrap": "^8.0.0",
"reaptcha": "^1.4.2",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"semantic-ui-react": "^0.86.0",
"socket.io-client": "^2.3.0",
"sweetalert2": "^10.14.0",
"sweetalert2-react": "^0.8.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
TL;DR Use npm install --legacy-peer-deps
I am able to replicate the error with npm#7 but not npm#6.
Version 7 introduced some stricter peer dependency checking. If you just want your installation command to succeed (which is what most people who encounter this error want, rather than figuring out what the dependency issue is), you can use npm install --legacy-peer-deps.
The source of the issue is that your version of react-card-flip requires react#17 but many of your other dependencies require react#16. Old npm worked around that. New npm let's you know there's a problem. You can live without react-card-flip, or update all your other dependencies (no guarantees they've all been updated to support react#17 though), or try to find an older version of react-card-flip that maybe supported react#16, although running a bunch of older versions of dependencies is not something I would recommend.
The solution was to update the package.json file and change the react-card-flip entry.
From:
"react-card-flip": "^1.0.11",
To:
"react-card-flip": "~1.0.11",
The carat (^) tells npm to install 1.0.11 or newer version of react-card-flip. It was trying to install the newer version 1.1.0, which relies on React version 17.0.1. The tilde (~) tells npm to install the newest minor release version. The latest minor version of react-card-flip is 1.0.11 and it requires React 16.14.0, matching what I have installed - resolving the problem.
Another work around solution is to run npm install with the parameter --legacy-peer-deps.
Use npm i react-card-flip --force
This will work for you as we can install this forcefully. And worked for me as well. I was facing the same issue while trying to install react-card-flip.
Related
I have the following package.json for my React project
{
"name": "webforms-react-sample",
"version": "1.0.0",
"description": "Sample projects for hosting React apps in a WebForms application.",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development --config webpack.dev.js",
"build-dev": "npx webpack --config webpack.dev.js",
"build-prod": "npx webpack --config webpack.prod.js"
},
"author": "Dimitris Vardalis",
"license": "ISC",
"devDependencies": {
"#babel/cli": "^7.1.0",
"#babel/core": "^7.1.0",
"#babel/preset-env": "^7.1.0",
"#babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.2",
"css-loader": "^6.7.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"style-loader": "^0.23.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0"
},
"dependencies": {
"react-hot-loader": "^4.6.5",
"react-router-dom": "^5.2.0"
}
}
I'm trying to run the build-dev script. When trying locally I can make that script to work as is expected so build is made. But when going to the build pipeline is returning me this:
npm WARN exec The following package was not found and will be installed: webpack#5.75.0
CLI for webpack must be installed.
> webforms-react-sample#1.0.0 build-dev
webpack-cli (https://github.com/webpack/webpack-cli)
We will use "npm" to install the CLI via "npm install -D webpack-cli".
> npx webpack --config webpack.dev.js
Do you want to install 'webpack-cli' (yes/no):
##[warning]Couldn't find a debug log in the cache or working directory
##[error]Error: Npm failed with return code: 1
I'm using Azure Devops and a windows machine agent (always using the latest version) for running the pipeline. And yes I'm installing npm packages before the step when trying to run that script. I don't have any npm cache step to avoid Azure caching old files and not updating on releases (this happened to me on other pipelines).
Current pipeline is this (see pictures)
pipeline steps part 1
Pipeline steps part2
I have already tried uninstalling the packages and reinstalling them, same results and been breaking my head for a while and still the same results.
Well I made it work by changing npm install step on React to npm install --force.
I have cloned the project from github and trying to run the react project in VS code.
I ran npm i and also tried npm i --force.
This is the log
npm WARN deprecated core-js#2.6.12: core-js#<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path C:\Users\55393\Desktop\Rapidx_Documentation\website\node_modules\puppeteer
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! ERROR: Failed to download Chromium r722234! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
npm ERR! Error: self signed certificate in certificate chain
npm ERR! at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
npm ERR! at TLSSocket.emit (events.js:315:20)
How to solve this?
I have attached package.json below
{
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus start",
"build": "docusaurus build",
"serve": "docusaurus serve",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
"version": "docusaurus-version",
"rename-version": "docusaurus-rename-version",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"docusaurus": "docusaurus"
},
"engines": {
"node": "v17.6.0"
},
"dependencies": {
"#azure/msal-browser": "^2.28.0",
"#azure/msal-react": "^1.4.4",
"#docusaurus/core": "^2.0.0-rc.1",
"#docusaurus/plugin-client-redirects": "^2.1.0",
"#docusaurus/plugin-content-docs": "^2.0.0-rc.1",
"#docusaurus/preset-classic": "^2.0.0-rc.1",
"#fortawesome/react-fontawesome": "^0.1.18",
"#mui/material": "^5.10.3",
"axios": "^0.27.2",
"bootstrap": "^5.1.3",
"chart.js": "^3.8.0",
"clsx": "^1.1.1",
"docker": "^1.0.0",
"docusaurus": "^1.14.7",
"docusaurus-lunr-search": "^2.1.15",
"docusaurus-pdf": "^1.2.0",
"docusaurus2-dotenv": "^1.4.0",
"env-cmd": "^10.1.0",
"jquery": "^3.6.0",
"moment": "^2.29.4",
"react": "^17.0.2",
"react-bootstrap": "^2.4.0",
"react-chartjs-2": "^4.3.1",
"react-dom": "^17.0.2",
"react-icons": "^4.4.0",
"react-markdown-editor-lite": "^1.3.2",
"react-paginate": "^8.1.3",
"react-player": "^2.10.1",
"react-scripts": "^5.0.1"
},
"devDependencies": {
"dotenv": "^16.0.2"
}
}
I'm trying to migrate react-scripts from my current version (1.1.4) to the latest 3.0.1 for obvious reasons, but I'm having a hell of a time.
Here's my current, build successful package.json
{
"name": "name",
"version": "0.1.0",
"homepage": ".",
"private": true,
"dependencies": {
"ajv": "^6.9.1",
"axios": "^0.18.0",
"axios-debug": "0.0.4",
"date-fns": "^1.30.1",
"formik": "1.2.0",
"history": "4.7.2",
"moment": "2.22.2",
"localforage": "1.7.3",
"prettier": "1.14.2",
"react": "^16.8.1",
"react-bootstrap": "0.32.4",
"react-checkbox-group": "4.0.1",
"react-datetime": "2.15.0",
"react-dom": "^16.3.2",
"react-render-debugger": "1.0.2",
"react-router-dom": "4.3.1",
"react-scripts": "1.1.4",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.87.1",
"styled-components": "^4.2.0",
"react-router-hash-link": "1.2.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
So I'm using npm so running npm install --save --save-exact react-scripts#3.0.1 installs the new react-scripts version, everything is updated correctly. I updated a few other packages that were needed as deps. No security vulnerabilities, everything was clean and installed correctly.
I'm using maven as a build system to build my app, once it tries to execute npm run build it fails on react-scripts build
The debug log is super unhelpful. The only error displayed is /node_modules/.bin/react-scripts: Permission denied
I've tried changing the permissions using chmod +x /node_modules/.bin/react-scripts but no luck.
I've tried deleting node_modules several times and reinstalling the modules using npm ci. Just about any issue I've found on github I've tried.
I'm not sure what else could be wrong.
Using node v11.9.0 and npm 6.5.0
Do I need to update in smaller version increments? I'm really at a loss
EDIT:
Something is wrong with npm in my case. Manually updating the package versions in package.json seems to work for now... I need to figure out why npm is broken for me
I am assuming I should be able to deploy my reactJS to an S3 instance on AWS but I do not know how to do this. I found publish-react-app on github and I am trying to follow those steps. When I execute npm run build I get this error stream:
c:\jrs\PM_01\React>npm run build
npm ERR! missing script: build
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jonat\AppData\Roaming\npm-cache\_logs\2018-09-05T18_57_19_811Z-debug.log
c:\jrs\PM_01\React>npm run build
> sample-app#1.0.0 build c:\jrs\PM_01\React
> react-scripts build
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sample-app#1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sample-app#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jonat\AppData\Roaming\npm-cache\_logs\2018-09-05T19_06_24_048Z-debug.log
I have no idea what I need to put into the scrips section of my package.json file. This is what my package.json file looks like:
{
"name": "sample-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --open"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"css-loader": "^1.0.0",
"style-loader": "^0.21.0",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
},
"dependencies": {
"cors": "^2.8.4",
"ebay-node-api": "^2.2.1",
"moment": "^2.20.1",
"moment-timezone": "^0.5.14",
"publish-react-app": "^1.0.1",
"react": "^15.6.2",
"react-barcode": "^1.3.4",
"react-dom": "^15.6.2",
"react-moment": "^0.7.0",
"react-redux": "^5.0.5",
"react-router-dom": "^4.1.1",
"redux": "^3.7.0",
"reselect": "^3.0.1",
"simple-flexbox": "^1.2.0"
},
"babel": {
"presets": [
[
"es2015",
{
"modules": false
}
],
"stage-2",
"react"
]
}
}
I created a free tier S3 on AWS and created a user and a bucket but I really dont know what else to do in order to get my application deployed.
Thanks.
Your package.json is missing the key build. Generally with tools such as create-react-app it comes with a build script to prepare assets for production. As for hosting, Heroku is pretty easy to get up and running quickly.
After i execute npm install, i see that the version of the typings is 1.0.3. But in my package.json, i wrote the exacty the verion that i want. Any idea what is going on ?
is npm always trying to install the latest ?
"devDependencies": {
"nodemon": "^1.9.2",
"promise": "^7.1.1",
"request": "^2.72.0",
"require-dir": "^0.3.0",
"typescript": "^1.8.7",
"typings": "^0.7.12"
}
When i run :
typings -v
1.0.3
Try remove the ^ and write only:
"typings": "0.7.12"