Error when trying to install react-twitter-embed - node.js

I'm trying to install react-twitter-embed on my react app. I have tried deleting and reinstalling my node_modules folder and clearing my npm cache. I've tried upgrading my node and npm to the latest version as well.
Here's the error I'm getting:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ant-design-pro#2.2.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^15.0.0 || ^16.0.0" from react-twitter-embed#3.0.3
npm ERR! node_modules/react-twitter-embed
npm ERR! react-twitter-embed#"*" 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.
Here's the list of current dependencies in my package.json
"#ant-design/icons": "^4.7.0",
"#antv/data-set": "^0.10.0",
"#apollo/client": "^3.4.11",
"#babel/runtime": "^7.2.0",
"#ethersproject/abi": "^5.4.1",
"#ethersproject/address": "^5.4.0",
"#ethersproject/bignumber": "^5.4.0",
"#ethersproject/bytes": "^5.4.0",
"#ethersproject/constants": "^5.4.0",
"#ethersproject/contracts": "^5.4.0",
"#ethersproject/providers": "^5.4.1",
"#ethersproject/solidity": "^5.4.0",
"#ethersproject/units": "^5.4.0",
"#material-ui/core": "^4.12.3",
"#web3-react/core": "^6.1.9",
"#web3-react/fortmatic-connector": "^6.1.6",
"#web3-react/injected-connector": "^6.0.7",
"#web3-react/ledger-connector": "^6.1.9",
"#web3-react/network-connector": "^6.1.9",
"#web3-react/portis-connector": "^6.1.9",
"#web3-react/torus-connector": "^6.1.9",
"#web3-react/trezor-connector": "^6.1.9",
"#web3-react/walletconnect-connector": "^6.2.6",
"#web3-react/walletlink-connector": "^6.2.6",
"accounting-js": "^1.1.1",
"antd": "^3.26.20",
"apollo-boost": "^0.4.9",
"axios": "^0.18.1",
"bizcharts": "^3.4.2",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"bootstrap": "^5.0.2",
"chalk": "^2.4.2",
"classnames": "^2.2.6",
"core-js": "^3.17.2",
"crypto-js": "^4.1.1",
"dayjs": "^1.10.7",
"echarts": "^5.2.2",
"echarts-for-react": "^3.0.1",
"enquire-js": "^0.2.1",
"graphql": "^15.5.3",
"graphql-tag": "^2.12.5",
"hash.js": "^1.1.5",
"lodash": "^4.17.10",
"lodash-decorators": "^6.0.0",
"math.js": "^1.1.46",
"memoize-one": "^5.0.0",
"moment": "^2.22.2",
"numeral": "^2.0.6",
"nzh": "^1.0.3",
"omit.js": "^1.0.0",
"only-last-promise": "^1.0.0",
"path-to-regexp": "^2.4.0",
"prop-types": "^15.7.2",
"qs": "^6.6.0",
"rc-animate": "^2.4.4",
"react": "^17.0.2",
"react-apollo": "^3.1.5",
"react-bootstrap": "^2.0.0-beta.4",
"react-click-outside": "^3.0.1",
"react-container-query": "^0.11.0",
"react-copy-to-clipboard": "^5.0.1",
"react-datepicker": "^4.2.1",
"react-detect-click-outside": "^1.1.1",
"react-device-detect": "^1.17.0",
"react-document-title": "^2.0.3",
"react-dom": "^17.0.2",
"react-fittext": "^1.0.0",
"react-media": "^1.8.0",
"react-redux": "^7.2.3",
"react-router-dom": "^4.3.1",
"redux": "^4.0.5",
"styled-components": "^5.3.3",
"web3-eth": "^1.6.0",
"web3-eth-contract": "^1.6.0",
"web3-utils": "^1.6.0"
},

As the error states, you need to have react 15 or 16 installed. Your package.json currently has react 17 instead. Change it to:
"react": "^16.0.0",
then re-run npm install.
PS: you will probably update some of the other dependencies as well then, e.g., "react-dom": "^17.0.2" probably won't work anymore.
The alternative is to write to the maintainers of the package you want and see when they think react 17 will be supported.
Update
Saurabh Nemade, the author of the package in question points out in the comments, this should no longer be necessary (nor should the describe error occur, I suppose), because react-twitter-embed now supports newer versions of react. (Thanks, Saurabh!)

you can run this command for the latest react version instead of uninstalling it
npm i react-tweet-embed

New react version is now supported with recent version of react-twitter-embed along with types.
Events will be also added sooner to the package as I am working towards making it cover all cases. :)

Related

React/React Native dependency issues

I've been working on a react native app, and I keep running into dependency issues. I finally ironed out my dependencies so that I can actually npm install. Now I am trying to add react-native-image-mapper, and while our app is using react 17, react-native-image-mapper wants react 16.8.3. I tried using that react version, but then all the rest of my dependencies were off. I was reading that react 17 was a "gradual" upgrade from 16, so I tried to npm i --force, but then my app would not run at all.
Here are the dependencies from package.json:
"#react-navigation/bottom-tabs": "^6.0.8",
"#react-navigation/native": "^6.0.4",
"#react-navigation/native-stack": "^6.2.2",
"#use-expo/font": "^2.0.0",
"axios": "^0.21.1",
"cloudinary": "^1.27.1",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"expo": "~42.0.1",
"expo-app-loading": "1.1.2",
"expo-camera": "^11.2.2",
"expo-font": "~9.2.1",
"expo-status-bar": "~1.0.4",
"express": "^4.17.1",
"firebase": "8.2.3",
"firebase-admin": "^9.12.0",
"morgan": "^1.9.1",
"pg": "^8.5.1",
"react": "17.0.1",
"react-native": "0.64.2",
"react-native-keyboard-aware-scroll-view": "^0.9.4",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "^3.4.0",
"react-native-select-dropdown": "^1.2.0",
"react-native-web": "^0.17.5",
"react-redux": "^7.2.4",
"redux": "^4.1.0",
"redux-devtools-extension": "^2.13.9",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"sequelize": "^6.3.5",
"uuid": "^8.3.2"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#babel/preset-react": "^7.12.10",
"#babel/register": "^7.12.10",
"babel-loader": "^8.2.2",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.26.1",
"esm": "^3.2.25",
"nodemon": "^1.19.4",
"react-dom": "17.0.1"
}
Here is the error message I get when I try to add react-native-image-mapper:
npm ERR!
npm ERR! While resolving: mole-tracks#0.0.1
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.8.3" from react-native-image-mapper#0.1.11
npm ERR! node_modules/react-native-image-mapper
npm ERR! react-native-image-mapper#"*" 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.
Is there any simple way to untangle problematic dependencies? Is there something glaringly wrong with our dependencies as they stand?
I'm looking for practical advice on how to solve this specific problem as well as tips for avoiding this kind of thing in the future.
Try to use this command
npm install --legacy-peer-deps
I looked at the react-native-image-mapper library and I can say that its structure is poor as a library therefore it gives you the error. If you want to use it anyway, I suggest you just copy the source code (which is only 1 page) and add it to your project as a component.
There is no need to install it because there are no native parts that exist in the code. Only JavaScript.

Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) on github actions

i have created an github action to deploy the code when pushed.
it cause this error when installing the packages.
Run npm i --no-optional && cd client && npm i --no-optional && cd ..
npm WARN read-shrinkwrap 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!
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
i know the issue is with the fsevents. it is not supported on linux. but i installed the package. it is not available in my package.json
"devDependencies": {
"#babel/cli": "^7.12.1",
"#babel/core": "^7.14.0",
"#babel/node": "^7.13.13",
"#babel/plugin-transform-runtime": "^7.13.15",
"#babel/preset-env": "^7.14.1",
"#types/react-router-dom": "^5.1.7",
"#types/styled-components": "^5.1.10",
"antd": "^4.16.2",
"cross-env": "^7.0.3",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"morgan": "^1.10.0",
"nodemon": "^2.0.7",
"prettier": "^2.2.1",
"react-awesome-reveal": "^3.8.1",
"react-i18next": "^11.10.0",
"styled-components": "^5.3.0"
},
"dependencies": {
"#babel/register": "^7.13.16",
"#babel/runtime": "^7.14.0",
"bcrypt": "^5.0.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"debug": "^4.3.1",
"dotenv": "^9.0.0",
"express": "^4.17.1",
"express-async-handler": "^1.1.4",
"joi": "^17.4.0",
"joi-password-complexity": "^5.1.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.12.7",
"object-hash": "^2.1.1",
"passport": "^0.4.1",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"react-autosuggest": "^10.1.0",
"validator": "^13.6.0"
}
i tried adding no-optional argument while npm i. and adding fsevent to optional dependencies. still causing same error.
I have something similar and is caused by nodemon. Had to revert to nodemon v1.19.4
I got this problem when using a GitHub Action task to deploy a Vue application in an Azure Static Web App.
Running npm audit fix and pushing the changed package-lock.json solved for me.
You have to remove package.lock.json and than use npm i

GH Action asks for authentication on npm install

There is a public repository on github with its corresponding package on npm, both are public. In previous buildings, a GitHub Action was publishing the package every time a new commit was merged on main branch.
The issue now is that the workflow is not working because npm install fails since it is asking for authentication.
This is the error stack:
Run npm install
npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR! https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR! npm login
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-02-06T03_46_34_194Z-debug.log
Error: Process completed with exit code 1.
These are the dependencies:
"dependencies": {
"amqplib": "^0.6.0",
"body-parser": "^1.18.2",
"cors": "^2.8.4",
"express": "^4.17.1",
"express-fileupload": "^1.1.4",
"gridfs-stream": "^1.1.1",
"http-status-codes": "^2.1.4",
"moment": "^2.24.0",
"mongoose": "^5.11.8",
"multer": "^1.4.1",
"redis": "^3.0.2",
"reflect-metadata": "^0.1.10"
},
"devDependencies": {
"#commitlint/cli": "^11.0.0",
"#commitlint/config-conventional": "^11.0.0",
"#types/amqplib": "^0.5.17",
"#types/body-parser": "^1.16.7",
"#types/cors": "^2.8.3",
"#types/express": "^4.17.9",
"#types/gridfs-stream": "^0.5.30",
"#types/multer": "^1.3.7",
"#types/node": "^14.14.16",
"#types/redis": "^2.8.6",
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-exec": "^5.0.0",
"gulp-string-replace": "^1.1.2",
"husky": "^4.3.8",
"merge-stream": "^2.0.0",
"typedoc": "^0.19.2",
"typescript": "^4.0.0"
}

Segmentation fault (core dumped) in a running node process running in docker container

My docker image is running on AWS ECS. It runs for some time and then the container crashes with the following message :
Segmentation fault (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 139
npm ERR! fantasyservice#1.0.0 server: tsc -p . && node --max-old-space-size=1700 ./dist/server.js
npm ERR! Exit status 139
npm ERR!
npm ERR! Failed at the fantasyservice#1.0.0 server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-08T07_51_00_148Z-debug.log
I found that this issue occurs when one of the libraries using C++ modules fails. My package.json has the following dependencies installed -
"dependencies": {
"#nestjs/graphql": "^6.5.3",
"#types/bull": "^3.10.6",
"#types/bull-arena": "^2.6.0",
"#types/check-types": "^7.3.1",
"#types/compression": "^1.0.1",
"#types/cors": "^2.8.6",
"#types/express": "^4.17.2",
"#types/graphql-type-json": "^0.3.2",
"#types/http-errors": "^1.6.2",
"#types/jsonwebtoken": "^8.3.5",
"#types/node": "^12.12.11",
"#types/node-fetch": "^2.5.3",
"#types/request": "^2.48.3",
"#types/request-promise": "^4.1.45",
"apollo-server-express": "^2.9.12",
"bcrypt": "^3.0.7",
"bull": "^3.12.1",
"bull-arena": "^2.6.4",
"check-types": "^11.0.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.4",
"core-util-is": "^1.0.2",
"cors": "^2.8.5",
"easygraphql-format-error": "0.0.3",
"express": "^4.17.1",
"express-graphql": "^0.9.0",
"express-winston": "^4.0.1",
"graphql": "^14.5.8",
"graphql-tools": "^4.0.6",
"graphql-type-json": "^0.3.1",
"http-errors": "^1.7.3",
"is-my-json-valid": "^2.20.0",
"jsonwebtoken": "^8.5.1",
"newrelic": "^6.3.0",
"object-mapper": "^6.0.1",
"pg": "^7.13.0",
"pug": "^2.0.4",
"redis": "^2.8.0",
"reflect-metadata": "^0.1.13",
"request": "^2.88.0",
"request-promise": "^4.2.5",
"segfault-handler": "^1.3.0",
"tsc-watch": "^4.0.0",
"tsconfig-paths": "^3.9.0",
"type-graphql": "^0.17.5",
"typeorm": "^0.2.20",
"typeorm-encrypted-column": "0.0.4",
"typeorm-naming-strategies": "^1.1.0",
"typescript": "^3.7.2",
"webpack-dev-server": "^3.9.0",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^4.2.1",
"winston-loggly-bulk": "^3.0.1"
}
And my docker file is the following
FROM node:10
RUN apt update
RUN npm install typescript -g
COPY package*.json ./
RUN npm install
RUN npm rebuild bcrypt --build-from-source
ADD . /app
WORKDIR /app
CMD npm run server
I have tried increasing the ulimit, changed the node version in docker file and reduced the --max-old-space-size but to no effect. I also found out that npm rebuild bcrypt --build-from-source fixes an issue with bcrypt that causes this problem and have added that in my docker file link.

NPM is giving me an error using npm install

A friend shared with me a theme he is developing for WordPress, and I cloned his repo in my /themes folder, first thing I tried was to run "npm install" in the theme folder in order to get gulp and other npm cool features.
This is what it returns:
$ npm install
npm ERR! code EINTEGRITY
npm ERR! sha1-fjL3W0e4epHQRhHxvxQQmsAGUdc= integrity checksum failed when using sha1: wanted sha1-fjL3W0e4epHQRhHxvxQQmsAGUdc= but got sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=. (36808 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rinor\AppData\Roaming\npm-cache\_logs\2020-04-04T17_30_54_859Z-debug.log
After trying installing it globally it gave me back the same error so I came up with uninstalling node.js from my pc and then download and install the LTS version (12.16.1). Rebooted, tested and it seemed to work as I tried typing "node -v" && "npm -v". But when I return to my theme and go for "npm install" it gives me the same error.
Here is my package.json content
{
"name": "ruce-theme",
"version": "1.0.0",
"description": "A starter theme",
"scripts": {
"watch": "gulp watch"
},
"dependencies": {
"bootstrap": "^4.0.0-beta.3",
"jquery": "^3.2.1",
"npm": "^6.4.1",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"#babel/core": "^7.3.3",
"#babel/preset-env": "^7.3.1",
"#babel/preset-react": "^7.0.0",
"babel-core": "^6.25.0",
"babel-loader": "^8.0.5",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-env": "^1.6.0",
"cross-env": "^5.0.1",
"css-loader": "^2.1.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^3.0.1",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0-beta.2",
"gulp-clean-css": "^3.9.1",
"gulp-clone": "^1.1.4",
"gulp-concat": "^2.6.1",
"gulp-cssnano": "^2.1.2",
"gulp-ignore": "^2.0.2",
"gulp-imagemin": "^4.0.0",
"gulp-merge": "^0.1.1",
"gulp-plumber": "^1.2.0",
"gulp-rename": "^1.2.2",
"gulp-rimraf": "^0.2.2",
"gulp-sass": "^3.1.0",
"gulp-sequence": "^0.4.6",
"gulp-sourcemaps": "2.6.2",
"gulp-uglify": "^3.0.0",
"gulp-watch": "^4.3.11",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1"
},
"license": "ISC"
}
These are the erros that the debug shows
20111 error code EINTEGRITY
20112 error sha1-fjL3W0e4epHQRhHxvxQQmsAGUdc= integrity checksum failed when using sha1: wanted sha1-fjL3W0e4epHQRhHxvxQQmsAGUdc= but got sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=. (36808 bytes)
20113 verbose exit [ 1, true ]
You don't mention whether you had package-lock.json or not. In some cases the following might help. But first make sure you understand what's going on. npm tells you that the checksum from https://registry.npm.org doesn't match the one from package-lock.json. Either it changed in the registry, or...
Solution Consider the line from the output:
npm ERR!
sha1-fjL3W0e4epHQRhHxvxQQmsAGUdc=
integrity checksum failed when using sha1: wanted
sha1-fjL3W0e4epHQRhHxvxQQmsAGUdc=
but got
sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
. (36808 bytes)
Find the package in package-lock.json by the first two integrity checksums (sha1-...), and put the third one (sha512-...) into its "integrity" field.
More on it here.

Resources