npm install Errors on mac 10.7.5 - node.js

I am learning mongodb and as part of my learning process, I installed mongodb, nodejs and npm. When I execute the instruction npm install, this is the error I get:
me$ npm install
npm WARN package.json # No repository field.
npm ERR! Darwin 11.4.2
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! version not found: mongodb#3.2.1
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/Sites/mongodb/chapter1/npm-debug.log
This is the package.json:
{
"scripts": {
"test": "gulp test",
"watch": "gulp watch"
},
"dependencies": {
"async": "0.9.0",
"mongodb": "3.2.1"
},
"devDependencies": {
"gulp": "3.8.11",
"gulp-mocha": "2.0.1",
"mocha": "2.2.4"
}
}
I created a database called mongodb so it can see it but, I don't know what is wrong. I read the npm install errors" but nothing points to the similar error so I can solve it myself. Please, help !!

npm ERR! version not found: mongodb#3.2.1
It means the version 3.2.1 of the mongodb package doesn't exist (see https://www.npmjs.com/package/mongodb - currently, last version in 2.1.4).
Just fix the version number in your package.json from:
"dependencies": {
"async": "0.9.0",
"mongodb": "3.2.1"
},
to
"dependencies": {
"async": "0.9.0",
"mongodb": "^2.1.4"
},
Then re-run npm install

Related

Could not resolve dependency with sanity in nextjs app

I am trying to deploy my next.js project, but I keep getting the following error with everything I do:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: rcd_drone#0.1.0
npm ERR! Found: #sanity/client#3.4.1
npm ERR! node_modules/#sanity/client
npm ERR! #sanity/client#"^3.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #sanity/client#"^2.11.0" from next-sanity-image#3.2.1
npm ERR! node_modules/next-sanity-image
npm ERR! next-sanity-image#"^3.2.1" 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.
I also have the following dependencies:
{
"name": "rcd_drone",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#babel/core": "^7.17.9",
"#sanity/client": "^3.2.0",
"#sanity/image-url": "^1.0.1",
"#stripe/stripe-js": "^1.25.0",
"canvas-confetti": "^1.5.1",
"next": "^12.1.0",
"next-sanity-image": "^3.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hot-toast": "^2.2.0",
"react-icons": "^4.3.1",
"frontmatter-markdown-loader": "^3.6.3",
"stripe": "^8.209.0"
},
"devDependencies": {
"#babel/preset-react": "^7.16.7",
"eslint": "8.13.0",
"eslint-config-next": "12.1.4"
}
}
Try doing the npm install --legacy-peer-deps within the Vercel project deploy page.
When deploying your project, go to the "build and output" settings, then in the npm command input write: npm install --legacy-peer-deps.
Select the override radio button, then try deploying.
Try deleting node_modules folder and package-lock.json file and run:
npm install --legacy-peer-deps
This is going to make fresh installation of the modules.

How do I solve npm install issue after deleting node_modules

I am trying to clean out my react-native project's package to do a clean npm install on a MacOS based system (my windows system for Android development has no issues in cleaning up package versions).
I started seeing errors in the npm instals complaining version differences betwces are not compatible and list differences between versions of each package in "rook project" and node_modules/ directory.
I do the usual fix by removing package-lock.json, delete the node_modules directory and re-run npm install. from my project folder. It immediately made the same error complaints. The problem is this, there is no node_modules in my project folder as I deleted it. And it did not create a new node_modules directory.
Given this issue, how do I debug this and fix it? Questions I'd like to find out:
how do I tell npm to tell me what it thinks root project value is (full path)?
How to tell npm to tell me where the full path to the node_modules directory it seems to see?
Finally, how do I force npm to do the right thing and focus my my project's collaterals and not look outside the project folder as it appears to be doing?
Some of my thoughts. I don't understand why it is making a package cersion comparison between root project and node_modules?
Seems that nodde and npm are doing different things in MacOS environment than in my windows system environment -- I don't understand this.
Anyone here can help me understand what is going on and how to solve it?
The Error output here:
thomas#Presonus americanaradio % npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: AmericanaRadio#0.0.2
npm ERR! Found: react#16.14.0
npm ERR! node_modules/react
npm ERR! react#"^16.13.1" from the root project
npm ERR! peer react#"^16.8" from
#react-native-community/async-storage#1.12.1
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.12.1" from the
root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.2" from react-native#0.66.4
npm ERR! node_modules/react-native
npm ERR! react-native#"^0.66.3" from the root project
npm ERR! peer react-native#">=0.59" from
#react-native-community/async-storage#1.12.1
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.12.1" 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 /Users/thomas/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/thomas/.npm/_logs/2021-12-10T15_47_02_669Z-debug.log
thomas#Presonus americanaradio %
The package.json content here:
{END)
"name": "AmericanaRadio",
"version": "0.0.2",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/checkbox": "^0.5.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/slider": "^3.0.3",
"node-fetch": "^2.6.1",
"react": "^16.13.1",
"react-native": "^0.66.3",
"react-native-background-timer": "^2.4.1",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "^1.9.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.15.2",
"react-native-simple-survey": "^3.1.2",
"react-native-swift": "^1.2.1",
"react-native-vector-icons": "^8.0.0",
"react-native-version-check": "^3.4.2",
"react-native-version-info": "^1.1.0",
"react-native-webview": "^11.3.1",
"react-navigation": "^4.4.3",
"react-navigation-drawer": "^2.6.0",
"react-navigation-stack": "^2.10.2",
"react-usestateref": "^1.0.8",
"socket.io-client": "^4.4.0"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.18.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
~
(END)
As noted in my description, the node_modules directory was deleted and running npm install failed and did not create a nodes_modules directory. So the error messages are confusing as I have no packages in my project directory (americanaradio).
Thank you for taking a look at this and hopefully a solution can come out of ths.
First check what library is giving you an error and try to reinstall or update that version . Try deleting node modules also . Then do npm install.

Google Cloud: Create A Simple Application With the API samples npm install failed

Following the instruction from here, https://cloud.google.com/bigquery/create-simple-app-api
cd to the samples folder
https://github.com/googleapis/nodejs-bigquery/tree/master/samples
The package.json is
https://github.com/googleapis/nodejs-bigquery/blob/master/samples/package.json
{
"name": "nodejs-docs-samples-bigquery",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"repository": "googleapis/nodejs-bigquery",
"engines": {
"node": ">=4"
},
"scripts": {
"test": "repo-tools test run --cmd npm -- run cover",
"ava": "ava -T 3m --verbose test/*.test.js system-test/*.test.js",
"cover": "nyc --reporter=lcov --cache ava -T 3m --verbose test/*.test.js system-test/*.test.js && nyc report"
},
"dependencies": {
"#google-cloud/bigquery": "1.2.0",
"#google-cloud/storage": "1.5.1",
"yargs": "10.0.3"
},
"devDependencies": {
"#google-cloud/nodejs-repo-tools": "2.1.3",
"ava": "0.24.0",
"nyc": "11.3.0",
"proxyquire": "1.8.0",
"sinon": "4.1.3",
"uuid": "3.1.0"
}
}
I run
npm install
I get errors
Home-iMac:samples user1$ npm install
npm WARN #google-cloud/bigquery#1.2.0 had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.
npm ERR! path /Users/user1/project1/gcp/nodejs/bigquery_api/nodejs-bigquery-test/samples/node_modules/.staging/#google-cloud/bigquery-78ee5bef/node_modules/#sindresorhus/is
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/user1/project1/gcp/nodejs/bigquery_api/nodejs-bigquery-test/samples/node_modules/.staging/#google-cloud/bigquery-78ee5bef/node_modules/#sindresorhus/is' -> '/Users/user1/project1/gcp/nodejs/bigquery_api/nodejs-bigquery-test/samples/node_modules/.staging/#sindresorhus/is-79439449'
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! /Users/user1/.npm/_logs/2018-04-27T19_38_14_391Z-debug.log
To fix the error, a hack solution is instead of using the package.json to install, I have to run this manually first
npm install --save #google-cloud/bigquery
Then I can run
npm install
again. This time, it will finish without problem.
But I would like to be able to just simply using package.json, using npm install only to install the packages.
I changed the package.json
From
"#google-cloud/bigquery": "1.2.0",
to
"#google-cloud/bigquery": "^1.2.0",
It still does not work.
Thanks!
#Tim - Thanks for the request to update, #google/bigquery 1.3.0 is being used for the example. The download link to the GitHub site was updated, but the sample code on the page itself is not updated.

npm error peer invalid webpack-dev-server#2.10.0 wants webpack#^2.2.0 ||

I have installed the dependencies via npm below is the package.json
{
"name": "springbootreactjs2",
"version": "1.0.0",
"description": "Spring boot with reactjs",
"scripts": {
"watch": "webpack --watch -d"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.17.1",
"react": "16.0.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"rest": "^2.0.0",
"webpack": "^2.2.0"
},
"devDependencies": {
"babel-core": "^6.18.2",
"babel-loader": "7.1",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0"
}
}
Whenever i want to install a dependency it keeps throwing the below error
npm WARN package.json springbootreactjs2#1.0.0 No repository field.
npm WARN package.json springbootreactjs2#1.0.0 No README data
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "react#16.0.0" "--save"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package webpack#3.10.0 does not satisfy its siblings' p
eerDependencies requirements!
npm ERR! peerinvalid Peer babel-loader#6.4.1 wants webpack#1 || 2 || ^2.1.0-beta
|| ^2.2.0-rc
npm ERR! peerinvalid Peer webpack-dev-server#2.10.0 wants webpack#^2.2.0 || ^3.0
.0
npm ERR! Please include the following file with any support request:
Below is the install command i am running
npm install --save reactstrap#next react react-dom
Originally the webpack version was 3.10.0 i manually modified the webpack version to 2.2.0 but still for some reasons is still picking version 3.10.0.
Not sure what's wrong here
Remove any dependencies from your package.json file that you don't have installed locally and try again
Update your npm using npm install -g npm#latest.
Install the missing dependencies using npm install
<dependency_name> and run your command again.
If that doesn't work, read on:
I was facing the same issue. Although I was able to install webpack using npm, I couldn't install webpack-cli. So I:
1) Updated npm version to the latest.
Installed yarn (using yum
or apt-get, etc.).
Installed all the dependencies(including
webpack-cli) using yarn
This solved my problem.

Npm start doesn't work in an Angular 2 and Laravel 5 project

I am working on a Laravel 5.2 and Angular 2 project and I've just finished setting up angular but when running npm start, I get the following error :
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! # postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # postinstall script 'typings install'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
Can you guys help me ?
This is the content of my package.json :
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch",
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"bootstrap-sass": "^3.0.0",
"concurrently": "^1.0.0",
"del": "^2.2.0"
},
"dependencies": {
"angular2": "2.0.0-beta.0",
"bootstrap-sass": "^3.0.0",
"elixir-typescript": "^1.1.2",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"laravel-elixir": "^4.0.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"systemjs": "0.19.6",
"zone.js": "0.5.10"
}
}
Your script is failing while trying to run 'typings install'.
1. Include typings in devDependencies
{
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4"
}
}
Run npm install
Create typings.json as below
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160807145350"
}
}
npm start
if you still having issue install typings globally
npm install typings --global
I too face this problem i do the following steps
1. i uninstall nodejs and install the latest version.
2. close the command promt and open.
3. execute npm install
4. execute npm build(not nesessery)
5. execute npm start
This works for me.

Resources