How to update all npm packages in a medium/advanced project? - npm

I'm trying to update Angular from version 11 to 12 and I'm following this tutorial: https://update.angular.io/?l=3&v=11.0-12.0
When I launch this command ng update #angular/core#12 #angular/cli#12 on the terminal I have this message:
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 0 dependencies.
Package '#angular/core' is not a dependency.
I can't resolve in noway, nothing change in my package.json. I'm tryng to update with npm i #angular/core#12 npi i #angular/cli#12, it works but when I'm going to install all packages in my package.json I have a lot of problem with dependency like this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: poc-architecture-angular#0.0.0
npm ERR! Found: #angular/common#12.1.5
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"~12.1.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/common#">=11.0.0 <12.0.0" from #ng-select/ng-select#6.1.0
npm ERR! node_modules/#ng-select/ng-select
npm ERR! #ng-select/ng-select#"^6.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 /home/andrea/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/andrea/.npm/_logs/2021-09-06T13_14_09_645Z-debug.log
I would to update Angular and after that all the outdated packages but I can't. Is something wrong? I tried also with npx npm-check-updates -u but with same dependencies issues.
This is my package.json:
{
"name": "poc-architecture-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0 --port 4200",
"build": "NODE_ENV=production ng build --prod",
"build:dev": "NODE_ENV=production ng build --source-map=true --prod",
"build:local": "ng build --watch --output-path /usr/share/nginx/html && tar -zcvf archive.tar.gz dist/prod/*",
"test": "ng test",
"test:coverage": "ng test --no-watch --code-coverage --browsers ChromeHeadlessNoSandbox",
"lint": "ng lint",
"e2e": "ng e2e",
"stylelint": "stylelint --fix \"src/**/*.scss\" --config .stylelintrc.json",
"stylelint:diff": "stylelint \"src/**/*scss\" --config .stylelintrc.json",
"format": "prettier --write \"src/app/**/*.{ts,html,scss}\"",
"format:diff": "prettier --list-different \"src/app/**/*.{ts,html,scss}\"",
"analize": "ng build --prod --stats-json && node_modules/.bin/webpack --json | webpack-bundle-analyzer ./dist/poc-architecture-angular/stats.json",
"compodoc": "./node_modules/.bin/compodoc -p ./tsconfig.base.json -w -s --language=it-IT -r 8081",
"docs:json": "compodoc -p ./tsconfig.json -e json -d .",
"storybook": "npm run docs:json && start-storybook -p 9001 --quiet -c .storybook",
"build-storybook": "npm run docs:json && build-storybook",
"cypress:open-local": "cypress open --config baseUrl=http://localhost:4200",
"cypress:run-local": "cypress run --config baseUrl=http://localhost:4200",
"sonar": "sonar-scanner"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/app/**/*.{ts,html,scss}": [
"prettier --write"
]
},
"exports": {
"./": "./*"
},
"private": true,
"dependencies": {
"#angular/animations": "~12.1.4",
"#angular/cdk": "^11.2.12",
"#angular/common": "~12.1.4",
"#angular/compiler": "^12.1.4",
"#angular/core": "^12.1.5",
"#angular/forms": "~12.1.4",
"#angular/material": "^11.2.12",
"#angular/platform-browser": "~12.1.4",
"#angular/platform-browser-dynamic": "~12.1.4",
"#angular/router": "~12.1.4",
"#fullcalendar/angular": "^5.5.0",
"#fullcalendar/core": "^5.5.1",
"#fullcalendar/daygrid": "^5.5.0",
"#fullcalendar/interaction": "^5.5.0",
"#ng-select/ng-select": "^6.1.0",
"#ngrx/effects": "^11.1.1",
"#ngrx/router-store": "^11.1.1",
"#ngrx/store": "^11.1.1",
"#ngrx/store-devtools": "^11.1.1",
"#storybook/preset-scss": "^1.0.3",
"chart.js": "^2.9.3",
"filesize": "^6.1.0",
"hammerjs": "^2.0.8",
"i": "^0.3.6",
"lodash-es": "^4.17.20",
"luxon": "^1.26.0",
"moment": "^2.29.1",
"ng2-date-picker": "^11.0.0",
"ng2-pdf-viewer": "^6.4.1",
"ngrx-store-localstorage": "^11.0.0",
"ngx-cookie-service": "^11.0.2",
"ngx-infinite-scroll": "^10.0.1",
"ngx-webstorage": "^7.0.1",
"npm": "^7.22.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "^12.2.2",
"#angular/cli": "^12.2.4",
"#angular/compiler-cli": "^12.1.4",
"#babel/core": "^7.13.10",
"#compodoc/compodoc": "^1.1.11",
"#ngrx/schematics": "^11.1.1",
"#storybook/addon-actions": "^6.1.21",
"#storybook/addon-backgrounds": "^6.1.21",
"#storybook/addon-docs": "^6.1.21",
"#storybook/addon-knobs": "^6.1.21",
"#storybook/addon-links": "^6.1.21",
"#storybook/addon-storysource": "^6.1.21",
"#storybook/addon-viewport": "^6.1.21",
"#storybook/angular": "^6.1.21",
"#types/faker": "^5.1.7",
"#types/fs-extra": "^5.0.2",
"#types/jasmine": "^3.5.14",
"#types/jasminewd2": "~2.0.3",
"#types/lodash": "^4.14.168",
"#types/luxon": "^1.26.3",
"#types/node": "^12.12.54",
"autoprefixer": "^10.0.1",
"babel-loader": "^8.2.2",
"codelyzer": "^6.0.0",
"css-loader": "^4.3.0",
"cypress": "^7.6.0",
"faker": "^5.1.0",
"husky": "^4.3.8",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.4",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"lint-staged": "^10.5.4",
"ng-packagr": "^12.2.1",
"postcss": "^8.1.0",
"postcss-loader": "^4.0.2",
"prettier": "^2.2.1",
"protractor": "~7.0.0",
"puppeteer": "~8.0.0",
"sass-loader": "^10.0.2",
"sonarqube-scanner": "2.8.0",
"style-loader": "^1.2.1",
"stylelint": "^13.6.1",
"stylelint-config-sass-guidelines": "^7.0.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-order": "^4.1.0",
"stylelint-scss": "^3.18.0",
"tailwindcss": "^2.2.6",
"tailwindcss-multi-column": "^1.0.2",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "~4.3.5",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^4.5.0"
}
}

Navigate to the root directory of your project and ensure it contains a package.json file:
cd /path/to/project
In your project root directory, run the update command:
npm update
To test the update, run the outdated command. There should not be any output.
npm outdated
Update globally-installed packages. If you are using npm version 2.6.0 or earlier, run this command to update all outdated global packages:
npm install npm#latest -g
However, please consider upgrading to the latest version of npm.

Related

#angular-devkit/build-angular dependency issue while upgrading from Angular 11.0.5 to 12.2.16

I am try to upgrade an Angular project from Angular v11 using ng update and got peer dependency error. I referred How do I read npm "conflicting peer dependency" error messages? to understand about the peer dependency errors, but it still does not help in this case.
. Here's the output of ng update:
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
#angular/cli 11.2.18 -> 12.2.9 ng update #angular/cli#12
#angular/core 11.2.14 -> 12.2.9 ng update #angular/core#12
There might be additional packages which don't provide 'ng update' capabilities that are outdated.
You can update the additional packages by running the update command of your package manager.
Upon running ng update #angular/cli#12 I get the below error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: #angular-devkit/build-angular#0.1100.7
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^12.2.16" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev #angular-devkit/build-angular#"^12.2.16" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/compiler-cli#12.2.16
npm ERR! node_modules/#angular/compiler-cli
npm ERR! peer #angular/compiler-cli#"^12.0.0" from #angular-devkit/build-angular#12.2.16
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^12.2.16" 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!
Here's my package.json
Before running ng update
{
"name": "my-first-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^11.0.5",
"#angular/common": "^11.0.5",
"#angular/compiler": "^11.0.5",
"#angular/core": "^11.0.5",
"#angular/forms": "^11.0.5",
"#angular/platform-browser": "^11.0.5",
"#angular/platform-browser-dynamic": "^11.0.5",
"#angular/router": "^11.0.5",
"bootstrap": "3.3.7",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.0.0",
"tslib": "^2.0.3",
"zone.js": "^0.10.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.1100.4",
"#angular/cli": "^11.0.4",
"#angular/compiler-cli": "^11.0.5",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.19.9",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}
}
After running ng update
{
"name": "my-first-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^12.2.16",
"#angular/common": "^12.2.16",
"#angular/compiler": "^12.2.16",
"#angular/core": "^12.2.16",
"#angular/forms": "^12.2.16",
"#angular/platform-browser": "^12.2.16",
"#angular/platform-browser-dynamic": "^12.2.16",
"#angular/router": "^12.2.16",
"bootstrap": "3.3.7",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.0.0",
"tslib": "^2.0.3",
"zone.js": "^0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "^12.2.16",
"#angular/cli": "^12.2.16",
"#angular/compiler-cli": "^12.2.16",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.19.9",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.16",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.3.5"
}
}
I checked the code https://github.com/angular/angular-cli/blob/12.2.x/packages/angular_devkit/build_angular/package.json
"peerDependencies": {
"#angular/compiler-cli": "^12.0.0",
As far as I know, ^12.0.0 should not cause a problem with 12.2.16 as it is in the same major version, so why am I still getting peer dependency error?
This is happening because of a Semver bug in npm. You should be able to fix it by adding --force to your upgrade command or use yarn instead.
ref. GitHub Issue
(I too had the exact issue, this worked fine for me)

vue.js - I'm getting an error when running my project

sudo npm run serve
> frontend#1.0.0 serve /home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda
> vue-cli-service serve
INFO Starting development server...
12% building 20/21 modules 1 active ...rojetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/webpack/buildin/global.js/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/webpack/lib/Dependency.js:226
throw new Error(
^
Error: module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)
at ProvidedDependency.set (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/webpack/lib/Dependency.js:226:9)
at iterationDependencies (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/webpack/lib/Compilation.js:940:21)
at factory.create (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/webpack/lib/Compilation.js:950:8)
at factory (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/webpack/lib/NormalModuleFactory.js:409:6)
at hooks.afterResolve.callAsync (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/webpack/lib/NormalModuleFactory.js:155:13)
at _fn0 (eval at create (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
at fileExistsWithCase (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:158:9)
at that.fileExistsWithCase (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:113:7)
at that.fileExistsWithCase (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:113:7)
at CaseSensitivePathsPlugin.fileExistsWithCase (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:83:5)
at that.getFilenamesInDir (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:106:10)
at CaseSensitivePathsPlugin.getFilenamesInDir (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:51:5)
at CaseSensitivePathsPlugin.fileExistsWithCase (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:89:8)
at that.getFilenamesInDir (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:106:10)
at Array.fs.readdir (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/case-sensitive-paths-webpack-plugin/index.js:67:5)
at Storage.finished (/home/shinier01/Projetos/EstudanaIrlanda/frontend-estudenairlanda/node_modules/#vue/cli-service/node_modules/enhanced-
resolve/lib/CachedInputFileSystem.js:55:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend#1.0.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend#1.0.0 serve 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! /home/shinier01/.npm/_logs/2020-11-10T18_21_27_165Z-debug.log
I tried to uninstall npm, vue and node, I deleted the .json files, but somehow nothing solves, and I always have this error when executing my command.
but this project is already running normally before, and now I gave an npm install and it updated the packages, but even if I give a roolbakc, or delete and install it again, nothing resolves.
{
"name": "frontend",
"version": "1.0.0",
"description": "A Vue.js project",
"author": ".....",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#vue/cli": "^4.5.8",
"#vue/cli-service": "^4.5.8",
"axios": "^0.20.0",
"buefy": "^0.9.3",
"firebase": "^7.22.0",
"vue": "^2.6.12",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^6.3.0",
"css-loader": "^5.0.1",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^4.1.1",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^5.4.0",
"webpack-bundle-analyzer": "^4.1.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
can someone help me solve this error, please?
I faced the same problem and found a solution.
In my case application started using V5 of webpack and it was built on V4. You can run: npm i -D webpack#^4.0.0 to reverse it to V4 and it should fix it.
Special thanks to Mark:
https://forum.layer0.co/t/error-module-property-was-removed-from-dependency/208

'npm ERR! Could not install from "android" as it does not contain a package.json file.\n' +

I couldn't execute below command and having error as per subject title .pls help
ionic cordova platform add android
ionic cordova add android
ionic cordova prepare android
S C:\Users\jj\Desktop\bento academy\Bentograms> ionic cordova platform add android
cordova.cmd platform add android Error: npm: Command failed with exit code 1 Error output: npm ERR! code ENOLOCAL npm ERR! Could not
install from "android" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\jj\AppData\Roaming\npm-cache_logs\2020-07-31T14_53_29_466Z-debug.log
at ChildProcess.whenDone (C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.cp.emit (C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) { stderr: 'npm ERR! code
ENOLOCAL\n' +
'npm ERR! Could not install from "android" as it does not contain a package.json file.\n' +
'\n' +
'npm ERR! A complete log of this run can be found in:\n' +
'npm ERR! C:\Users\jj\AppData\Roaming\npm-cache\_logs\2020-07-31T14_53_29_466Z-debug.log\n',
code: 1 } [ERROR] An error occurred while running subprocess cordova.
PS C:\Users\jj\Desktop\bento academy\Bentograms> ionic cordova prepare android
? Platform android is not installed! Would you like to install it? Yes
cordova.cmd platform add android --save
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "android" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jj\AppData\Roaming\npm-cache_logs\2020-07-31T14_32_53_529Z-debug.log
at ChildProcess.whenDone (C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.cp.emit (C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
stderr: 'npm ERR! code ENOLOCAL\n' +
'npm ERR! Could not install from "android" as it does not contain a package.json file.\n' +
'\n' +
'npm ERR! A complete log of this run can be found in:\n' +
'npm ERR! C:\Users\jj\AppData\Roaming\npm-cache\_logs\2020-07-31T14_32_53_529Z-debug.log\n',
Here is my package.json file
{
"name": "Bentograms",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/common": "~9.1.6",
"#angular/core": "~9.1.6",
"#angular/fire": "^6.0.2",
"#angular/forms": "~9.1.6",
"#angular/platform-browser": "~9.1.6",
"#angular/platform-browser-dynamic": "~9.1.6",
"#angular/router": "~9.1.6",
"#capacitor/android": "^2.3.0",
"#capacitor/core": "2.3.0",
"#ionic-native/camera": "^5.27.0",
"#ionic-native/core": "^5.0.7",
"#ionic-native/facebook": "^5.27.0",
"#ionic-native/file": "^5.27.0",
"#ionic-native/file-path": "^5.27.0",
"#ionic-native/google-plus": "^5.27.0",
"#ionic-native/ionic-webview": "^5.27.0",
"#ionic-native/native-storage": "^5.22.0-beta-1",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^5.0.0",
"#ionic/storage": "^2.3.0",
"cordova-browser": "^6.0.0",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-facebook4": "^6.4.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-googleplus": "^8.5.0",
"cordova-plugin-nativestorage": "^2.3.2",
"exif-js": "^2.3.0",
"firebase": "^7.16.0",
"rxjs": "~6.5.1",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.901.5",
"#angular/cli": "~9.1.5",
"#angular/compiler": "~9.1.6",
"#angular/compiler-cli": "~9.1.6",
"#angular/language-service": "~9.1.6",
"#capacitor/cli": "2.3.0",
"#ionic/angular-toolkit": "^2.1.1",
"#types/jasmine": "~3.5.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.871006065561-1u6n3q4iav5486cjc1kg3djl7410p873"
},
"cordova-plugin-nativestorage": {},
"cordova-plugin-camera": {},
"cordova-plugin-file": {}
}
}
}
Delete the "android" folder in the root directory.
The run the command again:
ionic cordova platform add android

Angular 8 npm install fails

I just recently upgraded to Angular 8 and my local build passing with aot. But in Jenkins build getting failed with below error. Can anyone help?
Here is the error
npm install
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues.
Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated circular-json#0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated uws#9.148.0: New code is available at github.com/uNetworking/uWebSockets.js
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git#github.com/pemrouz/buble.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
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! /root/.npm/_logs/2020-01-25T10_05_09_308Z-debug.log
here is my package json
"name": "olam-global-survey-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "~8.2.14",
"#angular/common": "~8.2.14",
"#angular/compiler": "~8.2.14",
"#angular/core": "~8.2.14",
"#angular/forms": "~8.2.14",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"popper": "^1.0.1",
"rxjs": "^6.2.1",
"rxjs-compat": "^6.2.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.803.23",
"#angular/cli": "~8.3.23",
"#angular/compiler-cli": "~8.2.14",
"#angular/language-service": "~8.2.14",
"#types/node": "~8.9.4",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.5.3"
}
}
It's a npm cache problem.
just find npm-cache folder and delete it,
open terminal in administrator mode or use sudo if your OS supports linux
or
use npm clean-install
When you upgrade angular 8 its installs all default packages with Bootstrap 4. Bootstrap 4 installs popper.js package which helps for tooltip
Initial popper.js version will be ^1.0.1 and it is not supported with Angular 8 and Node 13. So we have to upgrade the package to version "popper.js": "^1.16.1"

error Unexpected end of JSON input while parsing near '...","tarball":"https://'

I am getting
error Unexpected end of JSON input while parsing near
'...","tarball":"https://'
when I run npm install
Below is my package.json file:
{
"name": "gateway",
"version": "0.0.0",
"description": "Description for gateway",
"private": true,
"license": "UNLICENSED",
"cacheDirectories": [
"node_modules"
],
"dependencies": {
"#angular/common": "7.2.4",
"#angular/compiler": "7.2.4",
"#angular/core": "7.2.4",
"#angular/forms": "7.2.4",
"#angular/platform-browser": "7.2.4",
"#angular/platform-browser-dynamic": "7.2.4",
"#angular/router": "7.2.4",
"#fortawesome/angular-fontawesome": "0.3.0",
"#fortawesome/fontawesome-svg-core": "1.2.14",
"#fortawesome/free-solid-svg-icons": "5.7.1",
"#ng-bootstrap/ng-bootstrap": "4.0.2",
"#ngx-translate/core": "11.0.1",
"#ngx-translate/http-loader": "4.0.0",
"bootstrap": "4.2.1",
"core-js": "2.6.4",
"moment": "2.24.0",
"ng-jhipster": "0.9.1",
"ngx-cookie": "2.0.1",
"ngx-infinite-scroll": "7.0.1",
"ngx-webstorage": "2.0.1",
"rxjs": "6.4.0",
"swagger-ui": "2.2.10",
"tslib": "1.9.3",
"zone.js": "0.8.29"
},
"devDependencies": {
"#angular/cli": "7.3.1",
"#angular/compiler-cli": "7.2.4",
"#ngtools/webpack": "7.3.1",
"#types/jest": "24.0.0",
"#types/node": "10.12.24",
"angular-router-loader": "0.8.5",
"angular2-template-loader": "0.6.2",
"autoprefixer": "9.4.7",
"browser-sync": "2.26.3",
"browser-sync-webpack-plugin": "2.2.2",
"cache-loader": "2.0.1",
"codelyzer": "4.5.0",
"copy-webpack-plugin": "4.6.0",
"css-loader": "2.1.0",
"file-loader": "3.0.1",
"fork-ts-checker-webpack-plugin": "0.5.2",
"friendly-errors-webpack-plugin": "1.7.0",
"generator-jhipster": "5.8.2",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"husky": "1.3.1",
"jest": "24.1.0",
"jest-junit": "6.2.1",
"jest-preset-angular": "6.0.2",
"jest-sonar-reporter": "2.0.0",
"lint-staged": "8.1.3",
"merge-jsons-webpack-plugin": "1.0.18",
"mini-css-extract-plugin": "0.5.0",
"moment-locales-webpack-plugin": "1.0.7",
"optimize-css-assets-webpack-plugin": "5.0.1",
"prettier": "1.16.4",
"reflect-metadata": "0.1.13",
"rimraf": "2.6.3",
"simple-progress-webpack-plugin": "1.1.2",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.2.2",
"thread-loader": "2.1.2",
"to-string-loader": "1.1.5",
"ts-loader": "5.3.3",
"tslint": "5.12.1",
"tslint-config-prettier": "1.18.0",
"tslint-loader": "3.6.0",
"typescript": "3.2.4",
"postcss-loader": "3.0.0",
"xml2js": "0.4.19",
"webpack": "4.29.3",
"webpack-cli": "3.2.3",
"webpack-dev-server": "3.1.14",
"webpack-merge": "4.2.1",
"webpack-notifier": "1.7.0",
"webpack-visualizer-plugin": "0.1.11",
"workbox-webpack-plugin": "3.6.3",
"write-file-webpack-plugin": "4.5.0"
},
"engines": {
"node": ">=8.9.0"
},
"lint-staged": {
"{,src/**/}*.{md,json,ts,css,scss}": [
"prettier --write",
"git add"
]
},
"scripts": {
"prettier:format": "prettier --write \"{,src/**/}*.{md,json,ts,css,scss}\"",
"lint": "tslint --project tsconfig.json -e 'node_modules/**'",
"lint:fix": "npm run lint -- --fix",
"ngc": "ngc -p tsconfig-aot.json",
"cleanup": "rimraf target/{aot,www}",
"clean-www": "rimraf target//www/app/{src,target/}",
"start": "npm run webpack:dev",
"start-tls": "npm run webpack:dev -- --env.tls",
"serve": "npm run start",
"build": "npm run webpack:prod",
"test": "npm run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js",
"test:watch": "npm run test -- --watch",
"webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --env.stats=minimal",
"webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --profile --progress --env.stats=normal",
"webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal",
"webpack:build": "npm run cleanup && npm run webpack:build:main",
"webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
"webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
"webpack:test": "npm run test",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"
},
"jestSonar": {
"reportPath": "target/test-results/jest",
"reportFile": "TESTS-results-sonar.xml"
}
}
I have searched for solution and found out that running the below commands:
npm cache clean --force
npm cache verify
should solve the issue, but the issue still exits after running these commands and clearing cache.
My npm version is 6.4.1
and
node version is v10.15.3
This issue was solved by going to C:\Users\USERNAME\AppData\Roaming\npm-cache and deleting its contents manually and then later running cmd as Administrator and running npm install
NOTE: Running cmd as Administrator was to solve another error that occurred after deleting cache manually and running. The new issue was npm WARN tarball tarball data for typescript#3.2.4 seems to be corrupted. which would freeze the installation at this point. On searching the internet, found out that it might be due to lack of permission, as it was since it was solved after running as Administrator.