error when trying to install any package with the npm command - npm-install

this error appears when trying to install any package. The current version of npm is 8.19.2 , windows 11 and node 19.0.0
package.json
"dependencies": {
"#headlessui/vue": "^1.7.3",
"#heroicons/vue": "^2.0.12",
"#meforma/vue-toaster": "^1.3.0",
"#tailwindcss/forms": "^0.5.3",
"#vue-hero-icons/outline": "^1.7.2",
"#vue-hero-icons/solid": "^1.7.2",
"#vuepic/vue-datepicker": "^3.5.2",
"#vueuse/core": "^9.4.0",
"blitzar": "^1.2.2",
"vue": "^3.2.41",
"vue-axios": "^3.5.1",
"vue-doc-preview": "^0.3.2",
"vue-toasted": "^1.1.28",
"vuejs3-datepicker": "^1.0.12",
"vuex": "^4.1.0"
},
"devDependencies": {
"#vitejs/plugin-vue": "^3.2.0",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.18",
"stylelint-config-recommended": "^9.0.0",
"tailwindcss": "^3.2.1",
"vite": "^3.2.2"
}
npm i npmrc
npm ERR! code E404
npm ERR! 404 Not Found - GET https://skimdb.npmjs.com/registry/npmrc/-/npmrc-1.1.1.tgz - not_found
npm ERR! 404
npm ERR! 404 'npmrc#https://skimdb.npmjs.com/registry/npmrc/-/npmrc-1.1.1.tgz' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm cache clean --force
npm install --force
ncu -u
> All dependencies match the latest package versions :)

Related

Error trying to install Axios with npm in a Node.js project

I'm trying to install axios in a personal project for learning Node.js, mongoDB and express and I got stucked at an error when installing it with npm. The problem i get when executing npm i --save axios is this one:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code EPERM
npm ERR! syscall lstat
npm ERR! path F:\Laboral\Elonial\Curso Node.js\4-natours\node_modules\simple-swizzle
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, lstat 'F:\Laboral\Elonial\Curso Node.js\4-natours\node_modules\simple-swizzle'
npm ERR! [Error: EPERM: operation not permitted, lstat 'F:\Laboral\Elonial\Curso Node.js\4-natours\node_modules\simple-swizzle'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'lstat',
npm ERR! path: 'F:\\Laboral\\Elonial\\Curso Node.js\\4-natours\\node_modules\\simple-swizzle'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\djime\AppData\Local\npm-cache\_logs\2023-02-03T12_21_26_556Z-debug-0.log
I already tried installing it into the project with administrator permissions through cmd, but got same error. My package.json follows this right now:
{
"name": "natours",
"version": "1.0.0",
"description": "Project created by NukeSkull in order to learn node.js, express and mongoDB",
"main": "app.js",
"scripts": {
"start": "nodemon server.js",
"start:prod": "SET NODE_ENV=production&&nodemon server.js",
"debug": "ndb server.js",
"watch:js": "parcel watch ./public/js/index.js --out-dir ./public/js --out-file bundle.js",
"build:js": "parcel watch ./public/js/index.js --out-dir ./public/js --out-file bundle.js"
},
"author": "NukeSkull",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"cookie-parser": "^1.4.6",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"express-mongo-sanitize": "^2.2.0",
"express-rate-limit": "^6.6.0",
"helmet": "^3.23.3",
"hpp": "^0.2.3",
"jsonwebtoken": "^8.5.1",
"mapbox-gl": "^2.12.0",
"mongoose": "^5.13.15",
"morgan": "^1.10.0",
"nodemailer": "^6.7.8",
"nodemon": "^2.0.19",
"pug": "^3.0.2",
"slugify": "^1.6.5",
"validator": "^13.7.0",
"xss-clean": "^0.1.1"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"parcel-bundler": "^1.12.5",
"prettier": "^2.7.1"
},
"engines": {
"node": ">=10.0.0"
}
}
How can I solve this error so I can install axios?
Found my error, somehow windows antivirus was blocking me from installing it, disabling it allowed me to install axios. Thanks to #Samball for the answer

Can't execute npm install

When I am executing npm install this error shows. Any advice about this?
PS C:\Users\alex\Downloads\team> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: frontend#0.0.0
npm ERR! Found: #angular/compiler#13.1.3
npm ERR! node_modules/#angular/compiler
npm ERR! #angular/compiler#"~13.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/compiler#"13.0.3" from #angular/compiler-cli#13.0.3
npm ERR! node_modules/#angular/compiler-cli
npm ERR! dev #angular/compiler-cli#"~13.0.0" from the root project
npm ERR! peer #angular/compiler-cli#"^13.0.0" from #angular-devkit/build-angular#13.2.2
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^13.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! See C:\Users\ for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\
Here is Package.json file:
{
"name": "frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"#angular-devkit/build-angular": "^13.1.0",
"#angular/cdk": "^13.1.0",
"#angular/common": "~13.1.0",
"#angular/compiler": "~13.1.0",
"#angular/core": "~13.1.0",
"#angular/forms": "~13.1.0",
"#angular/platform-browser": "~13.1.0",
"#angular/platform-browser-dynamic": "~13.1.0",
"#angular/router": "~13.1.0",
"#types/jquery": "^3.5.13",
"bootstrap": "^5.1.3",
"bootstrap4-toggle": "^3.6.1",
"colors": "^1.4.0",
"jquery": "^3.6.0",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "^13.2.0",
"#angular/cli": "~13.0.4",
"#angular/compiler-cli": "~13.0.0",
"#types/jasmine": "~3.10.0",
"#types/node": "^12.11.1",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.3"
}
}
ERESOLVE issues with npm#7 and npm#8 are common because they are more strict about peer dependencies than npm#6. Often, the easiest resolution is to pass the --legacy-peer-deps flag to npm (e.g., npm i --legacy-peer-deps) or else use npm#6.
The "correct" solution is to figure out which of your dependencies need to be updated in package.json to avoid the peer dependency conflict, but that is sometimes not possible with dependencies that are unmaintained. In that case, the solution is to find or create something else to get rid of the unmaintained dependency.
However, 9 times out of 10, someone just wants to get the stuff installed and hope it works, in which case --legacy-peer-deps will do that. Just make sure you have good test coverage because you're using a different peer dependency version than that specified by a package so something somewhere might not work.
To see if the problem will affect your production app, do npm install --production. If it doesn't give you an ERESOLVE error, then the problem is in your dev dependencies only, which is less of a concern typically.

Error while upgrading EXPO version from SDK 42 to 44

I just tried to upgrade my expo app from SDK version 42 to version 44. I did the following commands:
npm i -g expo-cli
expo upgrade
When I try to run npm install i get this:
The expo package was found in your package.json but we couldn't resolve the Expo SDK version. Run npm install and then try this command again.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: expo-standard-web-crypto#1.2.0
npm ERR! Found: expo-random#12.1.2
npm ERR! node_modules/expo-random
npm ERR! expo-random#"~12.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional expo-random#"12.1.0" from expo-standard-web-crypto#1.2.0
npm ERR! node_modules/expo-standard-web-crypto
npm ERR! expo-standard-web-crypto#"^1.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: expo-random#12.1.0
npm ERR! node_modules/expo-random
npm ERR! peerOptional expo-random#"12.1.0" from expo-standard-web-crypto#1.2.0
npm ERR! node_modules/expo-standard-web-crypto
npm ERR! expo-standard-web-crypto#"^1.1.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 /Users/michaelschmitz/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/michaelschmitz/.npm/_logs/2022-02-21T19_18_50_348Z-debug.log
I've never updated expo before and am unfamiliar with working with dependencies and package.jsons
here is my package.json as well:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"update-deps": "npm install -g npm && npm install -g expo-cli && npm install",
"build-ios": "expo bi --release-channel beta -t archive",
"build-android": "expo ba --release-channel beta -t app-bundle"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^12.0.0",
"#react-native-community/slider": "4.1.12",
"#react-native-community/viewpager": "5.0.11",
"#react-native-masked-view/masked-view": "0.2.6",
"#react-navigation/drawer": "^5.12.9",
"#react-navigation/native": "^5.9.8",
"#react-navigation/stack": "^5.14.9",
"base-64": "^1.0.0",
"create-react-class": "^15.7.0",
"expo": "^44.0.0",
"expo-asset": "~8.4.6",
"expo-constants": "~13.0.1",
"expo-file-system": "~13.1.4",
"expo-font": "~10.0.4",
"expo-linking": "~3.0.0",
"expo-mail-composer": "~11.1.0",
"expo-notifications": "~0.14.0",
"expo-print": "~11.1.0",
"expo-sharing": "~10.1.0",
"expo-splash-screen": "~0.14.1",
"expo-sqlite": "~10.1.0",
"expo-standard-web-crypto": "^1.1.0",
"expo-status-bar": "~1.2.0",
"expo-web-browser": "~10.1.0",
"moment": "^2.29.1",
"native-base": "^2.13.15",
"pdf-lib": "^1.16.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-actionsheet": "^2.4.2",
"react-native-chart-kit": "^5.6.1",
"react-native-datepicker": "^1.7.2",
"react-native-elements": "^2.3.2",
"react-native-gesture-handler": "~2.1.0",
"react-native-modal": "^11.10.0",
"react-native-modal-picker": "^0.0.16",
"react-native-paper": "^4.9.2",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-simple-time-picker": "^0.2.0",
"react-native-svg": "12.1.1",
"react-native-web": "0.17.1",
"utf8": "^3.0.0",
"uuid": "^8.3.2",
"expo-random": "~12.1.1",
"expo-updates": "~0.11.6"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/react": "~17.0.21",
"#types/react-dom": "~17.0.9",
"#types/react-native": "~0.64.12",
"#types/uuid": "^8.3.1",
"#typescript-eslint/eslint-plugin": "^4.29.3",
"#typescript-eslint/parser": "^4.29.3",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.11.0",
"jest-expo": "^44.0.0",
"typescript": "~4.3.5"
},
"private": true
}
This is in a react-native app and I was previously using version 42.
From your error you should revert back to your last working Expo 42 commit. Then do the following
npm uninstall expo-random
expo install expo-standard-web-crypto
The first will remove any direct dependency to expo-random from your package.json.
The second will reinstall expo-standard-web-crypto to the currently supported version for Expo 42.
Do you your test and commit if it works.
Then retry the update.
General process
The general process I have when doing an upgrade is:
determine what direct dependencies are not needed by the app and uninstall them or move them to devDependencies if it should've been a dev dependency like jest, #types etc.
test to make sure app still works
attempt upgrade
note the errors and deal with the problematic dependencies
dealing with the problematic dependency may simply be updating the version of the dep, or
revendor the improper dependencies yourself since it may take months for any fix to go through upstream,
change your code so you don't use it because the upstream may no longer be maintained except by renovate bots

react native upgrade library conflict

I am working with a react native project where the existing libraries is compiled to support Android level 29 but now it is mandatory to upgrade to level 30, so I am trying to upgrade the library by running npx react-native upgrade
info No version passed. Fetching latest...
(node:38396) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
info Fetching diff between v0.61.5 and v0.65.1...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible
warn Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually
info Installing "react-native#0.65.1" and its peer dependencies...
error Command failed: npm install --save --save-exact react-native#0.65.1 react#17.0.2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #react-native-community/async-storage#1.11.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! peer react#"*" from #react-native-community/checkbox#0.4.2
npm ERR! node_modules/#react-native-community/checkbox
npm ERR! #react-native-community/checkbox#"^0.4.2" from the root project
npm ERR! 16 more (#react-native-community/datetimepicker, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8" from #react-native-community/async-storage#1.11.0
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.8.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#16.14.0
npm ERR! node_modules/react
npm ERR! peer react#"^16.8" from #react-native-community/async-storage#1.11.0
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.8.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 see ex. async-storage is causing the trouble here. I attach my package.json here, please guide me through the upgrade process?
"dependencies": {
"#react-native-community/async-storage": "^1.8.1",
"#react-native-community/checkbox": "^0.4.2",
"#react-native-community/datetimepicker": "^2.4.3",
"#react-native-community/masked-view": "^0.1.7",
"#react-native-firebase/app": "^8.1.0",
"#react-native-firebase/messaging": "^7.4.1",
"#react-navigation/bottom-tabs": "^5.2.4",
"#react-navigation/native": "^5.1.0",
"#react-navigation/stack": "^5.2.1",
"base-64": "^0.1.0",
"es6-shim": "^0.35.5",
"events": "^3.2.0",
"i18n-js": "^3.5.1",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-24h-timepicker": "^1.1.0",
"react-native-common-date-picker": "^2.3.1",
"react-native-date-picker": "^3.2.5",
"react-native-document-picker": "^4.0.0",
"react-native-elements": "^1.2.7",
"react-native-file-type": "0.0.8",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.6.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.3.4",
"react-native-popup-menu": "^0.15.7",
"react-native-push-notification": "^4.0.0",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.3.0",
"react-native-snap-carousel": "^3.8.4",
"react-native-svg": "^12.0.3",
"react-native-svg-charts": "^5.3.0",
"react-native-swipe-list-view": "^3.1.0",
"react-native-vector-icons": "^6.6.0",
"react-native-view-overflow": "0.0.5",
"react-relay": "^9.1.0",
"relay-runtime": "^9.1.0",
"rn-apple-healthkit": "^0.8.0",
"rn-fetch-blob": "^0.12.0",
"styled-components": "^5.1.1",
"twilio": "^3.48.1",
"twilio-chat": "^4.0.0"
},
my target lib for react native is the latest, but of course any lower version that make android level 30 will work
"dependencies": {
"react": "17.0.2",
"react-native": "0.65.1"
},

vue-cli-service#latest' is not in the npm registry on Windows. Works in WSL

I have a Vue app which I am trying to run using npm run start, but this gives me the following error when I run the command from either PowerShell or inside the VS Code terminal:
> economyapp#0.1.0 start C:\_code\myapp
> npx vue-cli-service serve
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/vue-cli-service - Not found
npm ERR! 404
npm ERR! 404 'vue-cli-service#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-11-28T17_22_02_307Z-debug.log
Install for [ 'vue-cli-service#latest' ] failed with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! economyapp#0.1.0 start: `npx vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the economyapp#0.1.0 start 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\User\AppData\Roaming\npm-cache\_logs\2020-11-28T17_22_02_401Z-debug.log
The npm run start command works when I run it from inside WSL, however the server does not hot reload when I make changes to the code. I have tried uninstalling and reinstalling Vue CLI and running npm install.
Here is my package.json:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "npx vue-cli-service serve",
"build": "npx vue-cli-service build",
"test": "npx vue-cli-service test:unit",
"lint": "npx vue-cli-service lint",
"serve": "npx vue-cli-service serve"
},
"dependencies": {
"axios": "^0.21.0",
"core-js": "^3.4.3",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"register-service-worker": "^1.6.2",
"store2": "^2.11.1",
"vue": "^3.0.0",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"#types/jest": "^24.0.19",
"#typescript-eslint/eslint-plugin": "^2.28.0",
"#typescript-eslint/parser": "^2.28.0",
"#vue/cli-plugin-babel": "^4.1.0",
"#vue/cli-plugin-eslint": "^4.1.0",
"#vue/cli-plugin-pwa": "^4.1.0",
"#vue/cli-plugin-router": "^4.1.0",
"#vue/cli-plugin-typescript": "^4.3.1",
"#vue/cli-plugin-vuex": "^4.1.0",
"#vue/cli-service": "^4.2.3",
"#vue/devtools": "^5.3.3",
"#vue/eslint-config-prettier": "^5.0.0",
"#vue/eslint-config-typescript": "^5.0.2",
"#vue/test-utils": "1.0.0-beta.29",
"eslint": "^6.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.0.0",
"lint-staged": "^9.4.3",
"prettier": "^1.19.1",
"typescript": "^3.8.3",
"vue-template-compiler": "^2.6.10"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,vue,ts}": [
"vue-cli-service lint",
"git add"
]
}
}
TL;DR: Run npm install.
vue-cli-service is provided by the #vue/cli-service in your devDependencies. Because you don't specify the package in the npx command, it fails if it has to look in the registry. Without npx, your npm script will look in node_modules/.bin for vue-cli-service. You can remove npx from your npm scripts and you should see the same results you're getting now.
The fact that npx isn't finding vue-cli-service indicates that you have not run npm install. Do that and your npm scripts should work as is. Without running npm install, you will certainly run into other issues once you fix this one.
If, for some reason, you want the npm scripts to work without running npm install, you can tell npx where to find the binary in the registry. Change npx vue-cli-service in your npm scripts to be npx -p #vue/cli-service vue-cli-service instead and it should fix this problem. But you will certainly run into other problems. You'll want npm install regardless.
But to really get at the root of things, you'll need to figure out why the difference between WSL and non-WSL environments in your setup. My guess is that you have #vue/cli-service installed globally somewhere that only WSL finds it in your PATH but that's just a guess.