NPM Install Errors - node.js

When running npm install I am getting an error that isn't reproducible on other computers. After installing everything and running webpack build it spews out an error. When looking at the directory webpack should have installed in it doesn't even exist. Is this a known npm install bug on mac?
Error when running
npm install:
> www# postinstall /Users/mackenzie/Desktop/omitted/www
> npm run webpack-build
> www# webpack-build /Users/mackenzie/Desktop/omitted/www
> NODE_ENV=production ./node_modules/.bin/webpack -p --no-color
sh: ./node_modules/.bin/webpack: No such file or directory
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/Users/mackenzie/Desktop/omitted/www/node_modules/.bin/npm" "run" "webpack-build"
npm ERR! node v7.4.0
npm ERR! npm v3.10.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! www# webpack-build: `NODE_ENV=production ./node_modules/.bin/webpack -p --no-color`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the www# webpack-build script 'NODE_ENV=production ./node_modules/.bin/webpack -p --no-color'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the www package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=production ./node_modules/.bin/webpack -p --no-color
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs www
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls www
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/mackenzie/Desktop/omitted/www/npm-debug.log
npm WARN www# No license field.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! www# postinstall: `npm run webpack-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the www# postinstall script 'npm run webpack-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the www package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run webpack-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs www
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls www
package.json
"scripts": {
"lint": "semistandard web/js/orders/* web/js/categories/* web/js/orders/* web/js/site/* web/js/user/*",
"webpack-dev": "NODE_ENV=development ./node_modules/.bin/webpack --watch --progress",
"webpack-build": "NODE_ENV=production ./node_modules/.bin/webpack -p --no-color",
"postinstall": "npm run webpack-build"
},
"devDependencies": {
"autoprefixer": "^6.5.2",
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"browser-sync": "^2.17.5",
"browser-sync-webpack-plugin": "^1.1.3",
"css-loader": "^0.25.0",
"eslint": "^3.10.1",
"eslint-config-semistandard": "^7.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-config-standard-react": "^4.2.0",
"eslint-loader": "^1.6.1",
"eslint-plugin-promise": "^3.3.2",
"eslint-plugin-standard": "^2.0.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"path": "^0.12.7",
"postcss-loader": "^1.1.0",
"semistandard": "^9.0.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.3",
"webpack-dev-middleware": "^1.8.4",
"webpack-hot-middleware": "^2.13.1"
},
"dependencies": {
"i": "^0.3.5",
"lodash": "^4.16.6",
"npm": "^3.10.9",
"react": "^15.3.2",
"react-addons-css-transition-group": "^15.3.2",
"react-dom": "^15.3.2"
}

NPM picked is different
npm ERR! npm v3.10.9
npm ERR! npm v4.0.5

Try:
sudo npm install --unsafe-perm=true --allow-root
suggested by external link to solution

Related

how to fix npm install for react native

i am using react native to build a app every time I try to install a npm package i have to use --force, or --legacy-peer-deps to make it install else i get error so i thought it is because of version of react in my pakgage.json so i dissided to downgrade my react to 17.0.1 from 18.1.0 and i deleted my pakage.lock.json and node modules and i tried npm i then I am getting this error i want to get a clean installation for react native
npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: sukprsavam#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-native#"^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.11
npm ERR! node_modules/#react-native-async-storage/async-storage
npm ERR! #react-native-async-storage/async-storage#"^1.17.11" 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! peer react#"18.1.0" from react-native#0.70.6
npm ERR! node_modules/react-native
npm ERR! react-native#"0.70.6" from the root project
npm ERR! peer react-native#"^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.11
npm ERR! node_modules/#react-native-async-storage/async-storage
npm ERR! #react-native-async-storage/async-storage#"^1.17.11" 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 C:\Users\vivek\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vivek\AppData\Local\npm-cache\_logs\2023-01-04T06_02_30_598Z-debug-0.log
"name": "newapp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"#react-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.7",
"axios": "^1.2.2",
"expo": "~47.0.9",
"expo-status-bar": "~1.4.2",
"moment": "^2.29.4",
"react": "18.1.0",
"react-client-session": "^0.0.8",
"react-native": "0.70.5",
"react-native-network-logger": "^1.13.0",
"react-native-paper": "^5.1.2",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}

Can't resolve some dependency errors in nodejs

I was trying to install dependencies of a website and I get this error that I couldn't solve following some of the already published solutions.
Here is the error. Thanks in advance for your help.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: samar#0.1.0
npm ERR! Found: react#17.0.2
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#"^0.14.0 || ^15.0.0" from react-rangeslider#2.2.0
npm ERR! node_modules/react-rangeslider
npm ERR! react-rangeslider#"^2.2.0" 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/intelligentica/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/intelligentica/.npm/_logs/2022-03-23T15_30_51_251Z-debug-0.log
The package.json file is here.
{
"name": "samar",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 5000",
"build": "next build",
"start": "next start",
"sass": "node-sass --watch scss/main.scss css/style.css --source-map css/style.css.map"
},
"dependencies": {
"moment": "^2.29.1",
"next": "^10.0.6",
"node-sass": "^5.0.0",
"react": "^17.0.1",
"react-bootstrap": "^1.5.0",
"react-countup": "^4.3.3",
"react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0",
"react-modal-video": "^1.2.6",
"react-rangeslider": "^2.2.0",
"react-router-dom": "^5.2.0",
"react-scroll-to-top": "^1.0.5",
"react-slick": "^0.28.0",
"react-visibility-sensor": "^5.1.1",
"simple-react-lightbox": "^3.6.6",
"slick-carousel": "^1.8.1",
"use-scroll-position": "0.0.4",
"wowjs": "^1.1.3"
}
}
I would suggest you to delete the node-modules folder and make sure to install dependencies latest version by adding
npm i packagename#latest
Delete the node_modules folder and install the dependencies using --force, or --legacy-peer-deps
npm install --force

React application from github not running on VS Code

sorry for newbie question. I have downloaded a react application from github. When I try to run locally on VS Code it gives me some dependencies errors.
Below is the dependencies on the json file:
"dependencies": {
"#chakra-ui/react": "^1.8.5",
"#emotion/react": "^11",
"#emotion/styled": "^11",
"#hookform/resolvers": "^2.8.8",
"algoliasearch": "^4.12.1",
"axios": "^0.26.0",
"framer-motion": "^6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hook-form": "^7.27.1",
"react-icons": "^4.3.1",
"react-images-uploading": "^3.1.3",
"react-instantsearch-dom": "^6.22.0",
"react-query": "^3.34.16",
"react-router-dom": "^6.2.1",
"react-table": "^7.7.0",
"recharts": "^2.1.9",
"sass": "^1.49.9",
"yup": "^0.32.11",
"zustand": "^3.7.0"
}
Error:
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: admin-family#0.0.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#"^16.8.0" from react-images-uploading#3.1.3
npm ERR! node_modules/react-images-uploading
npm ERR! react-images-uploading#"^3.1.3" 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 C:\Users\12392\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\12392\AppData\Local\npm-cache\_logs\2022-03-09T00_59_26_007Z-debug-0.log
Running node v16.14.0
Any help on this appreciated.
run npm install --force or npm install --legacy-peer-deps
this will fix the error, because it ignores the peer dependencies and focuses on the main dependencies.
this has worked for me whenever i've gotten this error

NPM MOdule: react-csv-downloader on install gives Babel not found error

I am looking to install react-csv-downloader package in my project.
when i do npm install react-csv-downloader --save i get this error
react-csv-downloader#0.1.4 postinstall /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader
> npm run build
> react-csv-downloader#0.1.4 build /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader
> babel src -d dist
sh: 1: babel: not found
npm ERR! react-csv-downloader#0.1.4 build: `babel src -d dist`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the react-csv-downloader#0.1.4 build script.
npm ERR! This is most likely a problem with the react-csv-downloader package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel src -d dist
npm ERR! You can get their info via:
npm ERR! npm owner ls react-csv-downloader
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! cwd /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader/npm-debug.log
npm ERR! not ok code 0
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! react-csv-downloader#0.1.4 postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-csv-downloader#0.1.4 postinstall script.
npm ERR! This is most likely a problem with the react-csv-downloader package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get their info via:
npm ERR! npm owner ls react-csv-downloader
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "react-csv-downloader" "--save"
npm ERR! cwd /home/tops/Desktop/demo_projects/mern_stack
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/tops/Desktop/demo_projects/mern_stack/npm-debug.log
npm ERR! not ok code 0
I am using gulp in my project and here is my package.json
"dependencies": {
"babel-preset-react": "^6.16.0",
"babelify": "^7.3.0",
"bluebird": "^3.4.6",
"body-parser": "^1.15.2",
"browserify": "^13.1.0",
"express": "^4.14.0",
"fixed-data-table": "^0.6.3",
"fs": "0.0.1-security",
"gulp": "^3.9.1",
"history": "^4.3.0",
"jquery": "^3.1.1",
"json2xls": "^0.1.2",
"mongodb": "^2.2.10",
"multer": "^1.2.0",
"react": "^15.3.2",
"react-bootstrap": "^0.30.5",
"react-bootstrap-table": "^2.5.5",
"react-dom": "^15.3.2",
"react-router": "^2.8.1",
"superagent": "^2.3.0",
"superagent-bluebird-promise": "^4.1.0",
"superagent-promise-headers": "^1.2.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
},
Please help me to install this package.
Thanks.
It's not mentioned anywhere in the docs, but you will need to add babel-cli as your dev dependency and it will work.

How to install bcrypt for nodejs on Openshift?

Using https://github.com/icflorescu/openshift-cartridge-nodejs to get recent version of node, I ran npm install and got the following error:
npm ERR! Linux 2.6.32-573.12.1.el6.x86_64
npm ERR! argv "/var/lib/openshift/56c8cd172d527182dd0000e7/app-root/data/.nodejs/bin/node" "/var/lib/openshift/56c8cd172d527182dd0000e7/app-root/data/.nodejs/bin/npm" "install"
npm ERR! node v5.6.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.5 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/lib/openshift/56c8cd172d527182dd0000e7/app-root/runtime/repo/src/bookmap/npm-debug.log
I already tried to explicitly list node-gyp as a dependency in package.json, which results in the same error. Here's my current dependencies from package.json:
"dependencies": {
"angular": "^1.4.8",
"angular-datepicker": "~1.0.5",
"angular-route": "^1.4.8",
"angular-simple-logger": "^0.1.7",
"angular-ui-bootstrap": "^0.14.3",
"node-gyp": "",
"bcrypt": "^0.8.5",
"body-parser": "^1.14.1",
"bootstrap": "^3.3.6",
"bower": "^1.3.9",
"express": "^4.13.3",
"gulp": "^3.8.7",
"gulp-connect": "^2.0.6",
"jwt-simple": "^0.4.0",
"leaflet": "^0.7.7",
"lodash": "^3.10.1",
"path": "^0.12.7",
"pg": "^4.4.3",
"ui-leaflet": "^1.0.0",
"winston": "^2.1.1"
}
node-gyp installs just fine with npm install node-gyp.
I recommend using the javascript version of bcrypt so you don't have to deal with building it on openshift. We use bcrypt-nodejs on openshift and it works well https://www.npmjs.com/package/bcrypt-nodejs
All you need is just to put it under dependencies in package.json. This is what we have but you can check and get the latest version:
"bcrypt-nodejs": ">=0.0.3",
bcrypt-nodejs is not working in openshift.
use this https://www.npmjs.com/package/bcryptjs

Resources