Run Time Error: cannot find module "ionic-native" - node.js

I'm trying to connect ionic 2 app to backand and getting this run time error:
Cannot find module "ionic-native".
I have tried running npm install #ionic-native/core --save – but does not help. Many thanks
Set Up Details Are Here: Ionic Framework: 3.0.1 Ionic App Scripts:
1.3.0 Angular Core: 4.0.0 Angular Compiler CLI: 4.0.0 Node: 6.10.1 OS Platform: Windows 10 Navigator Platform: Win32 User Agent: Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/57.0.2987.133 Safari/537.36
Error: Cannot find module "ionic-native" at g
(localhost:8100/build/polyfills.js:3:7133) at Object.module.exports
(localhost:8100/build/main.js:114616:7) at webpack_require
(localhost:8100/build/main.js:20:30) at Object.
(localhost:8100/build/main.js:86362:73) at webpack_require
(localhost:8100/build/main.js:20:30) at Object.
(localhost:8100/build/main.js:140153:70) at webpack_require
(localhost:8100/build/main.js:20:30) at
localhost:8100/build/main.js:66:18
Package.Json as follows:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "4.0.0",
"#angular/compiler": "4.0.0",
"#angular/compiler-cli": "4.0.0",
"#angular/core": "4.0.0",
"#angular/forms": "4.0.0",
"#angular/http": "4.0.0",
"#angular/platform-browser": "4.0.0",
"#angular/platform-browser-dynamic": "4.0.0",
"#ionic-native/core": "3.4.2",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"socket.io-client": "^1.7.3",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.0",
"#types/node": "7.0.13",
"#types/socket.io-client": "1.4.29",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"cordova-plugin-inappbrowser"
],
"cordovaPlatforms": [],
"description": "myApp: An Ionic project"
}

This issue is associated with the old import 'ionic-native'
in my case :
import { StatusBar, Splashscreen } from 'ionic-native';
I removed and added the new :
https://ionicframework.com/docs/native/status-bar
https://ionicframework.com/docs/native/splash-screen
If this is also your case, do not forget to add also in the module provider

With Ionic 3, the ionic-native modules are now loaded as providers. See below links:
https://github.com/driftyco/ionic/blob/master/CHANGELOG.md
http://blog.ionic.io/ionic-native-3-x/
https://github.com/driftyco/ionic-conference-app/commit/62088
So, you have to upgrade your code if you want to use any of the native features.

Related

Error: Failed to transpile TypeScript Error: Failed to transpile TypeScript

I have an application that uses ionic and angular. For deploying the same application as a mobile app, I tried ionic cordova build android, which gave me an error. bash: ionic: command not found
So, without realizing what disaster it could cause I installed it using the command.
npm install -g #ionic/cli.
Then I again run the command ionic cordova build android.
But due to the version of node being 8.12.0 installed in my machine, it gave me an error and I couldn't run that command.
and I reinstall the node, and tried again.
And now coming back to the application, I tried to build that to production, since then it is always giving me an error saying
Cannot find type definition file for '#types'.
I removed the ionic CLI, uninstall node js, and uninstall npm. Uninstall everything related to node. But the problem has not been gone yet.
I also deleted node_modules and package-lock json and npm cache clean --force, npm install.
But it did not work.
As the error says Cannot find type definition file for '#types', I also added the types in tsconfig.json,
"types": [],
into
"compilerOptions"
Though the error goes away while npm run build --prod --verbose, but the application doesn't run further, it gave a lot of error in the console and the application just stopped.
package.json
{
"name": "ClientApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "node --max-old-space-size=8192 ./node_modules/#ionic/app-scripts/bin/ionic-app-scripts.js build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/animations": "5.2.9",
"#angular/common": "5.2.9",
"#angular/compiler": "5.2.9",
"#angular/compiler-cli": "5.2.9",
"#angular/core": "5.2.9",
"#angular/forms": "5.2.9",
"#angular/http": "5.2.9",
"#angular/platform-browser": "5.2.9",
"#angular/platform-browser-dynamic": "5.2.9",
"#ionic-native/core": "4.6.0",
"#ionic-native/splash-screen": "4.6.0",
"#ionic-native/status-bar": "4.6.0",
"#ionic/pro": "1.0.20",
"#ionic/storage": "2.1.3",
"alertify.js": "^1.0.12",
"angular-tree-component": "^7.1.0",
"angular2-cookie": "^1.2.6",
"angular2-indexeddb": "^1.2.2",
"blueimp-canvas-to-blob": "^3.20.0",
"bootstrap": "^4.1.0",
"chart.js": "^2.9.3",
"cordova-android": "7.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"dragula": "^3.7.2",
"idlejs": "^2.1.0",
"ionic-angular": "3.9.2",
"ionic3-star-rating": "^2.1.2",
"ionicons": "3.0.0",
"jquery": "^3.3.1",
"microsoft-applicationinsights-angular5": "^0.1.6",
"ng2-ckeditor": "^1.2.0",
"ng2-dragula": "^2.1.1",
"ng2-google-charts": "^6.0.0",
"ng2-img-max": "^2.2.4",
"ng2-order-pipe": "^0.1.5",
"ng2-pagination": "^2.0.2",
"ng4-validators": "^6.0.0",
"ngx-autosize": "^1.8.0",
"ngx-color-picker": "^7.0.2",
"ngx-order-pipe": "^2.0.4",
"ngx-pinch-zoom": "^2.4.4",
"ngx-skeleton-loader": "^1.2.7",
"node-sass": "^4.14.1",
"popper.js": "^1.14.3",
"rxjs": "5.5.8",
"sw-toolbox": "3.6.0",
"xlsx": "^0.17.0",
"zone.js": "0.8.20"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.4",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {}
},
"platforms": [
"android"
]
},
"config": {
"ionic_www_dir": "../",
"ionic_build_dir": "../build"
}
}
what should I do to build this application, which was built before but now had stopped?

Run Out of Memory Using Node Build 'ng build' - Angular App

I am trying to build my angular application using 'ng build'. It is failing because it is running out of memory to build as I surmise from my research. I have tried several of the solutions out there with no luck. After typing 'ng build' either from VSC terminal or on DOS line, it runs for about 3 minutes during this step:
Generating ES5 bundles for differential loading...
then it fails with this error written to my angular-errors.log file:
[error] Error: Call retries were exceeded
at ChildProcessWorker.initialize (c:\development\gems\Frontend_Serenity_A9_SLIM\Frontend_Serenity_A9\node_modules\jest-worker\build\workers\ChildProcessWorker.js:193:21)
at ChildProcessWorker.onExit (c:\development\gems\Frontend_Serenity_A9_SLIM\Frontend_Serenity_A9\node_modules\jest-worker\build\workers\ChildProcessWorker.js:263:12)
at ChildProcess.emit (events.js:203:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
I have tried increasing my memory as some articles/stack overflows have indicated. I tried this:
npm install -g increase-memory-limit
and then ran this command at the root of my angular project:
increase-memory-limit
to no avail. Using es5 rather than es2015 is not a solution for our app. Any help or ideas you can offer are GREATLY appreciated. I have been trying everything for a week now and am still stuck. Thanks!
package.json contents:
{
"name": "serenity",
"version": "9.0.0",
"license": "PrimeNG Commercial",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "9.0.4",
"#angular/cdk": "9.1.0",
"#angular/common": "9.0.4",
"#angular/compiler": "9.0.4",
"#angular/core": "9.0.4",
"#angular/forms": "9.0.4",
"#angular/material": "^9.1.0",
"#angular/platform-browser": "9.0.4",
"#angular/platform-browser-dynamic": "9.0.4",
"#angular/router": "9.0.4",
"#aspnet/signalr": "^1.1.4",
"#fullcalendar/core": "4.0.2",
"#fullcalendar/daygrid": "4.0.1",
"#fullcalendar/interaction": "4.0.2",
"#fullcalendar/timegrid": "4.0.1",
"#handsontable/angular": "^5.1.1",
"#mdi/svg": "^5.3.45",
"#types/leaflet-draw": "^1.0.2",
"#types/plotly.js": "^1.50.12",
"chart.js": "2.7.3",
"d3": "^5.16.0",
"font-awesome": "4.7.0",
"handsontable": "^7.4.2",
"intl": "1.2.5",
"leaflet": "^1.6.0",
"leaflet-draw": "^1.0.4",
"leaflet-sidebar-v2": "^3.2.2",
"leaflet.control.layers.tree": "^1.0.0",
"leaflet.glify": "^3.0.0",
"material-design-icons": "^3.0.1",
"plotly.js-dist": "^1.54.1",
"primeflex": "1.0.0",
"primeng": "9.0.1",
"prismjs": "1.15.0",
"quill": "1.1.8",
"rxjs": "6.5.4",
"three": "^0.117.1",
"web-animations-js": "github:angular/web-animations-js#release_pr208",
"xlsx": "^0.16.2",
"zone.js": "0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "0.900.4",
"#angular/cli": "9.0.4",
"#angular/compiler-cli": "9.0.4",
"#angular/language-service": "9.0.4",
"#types/jasmine": "3.5.7",
"#types/jasminewd2": "2.0.8",
"#types/leaflet": "^1.5.17",
"#types/node": "12.12.29",
"codelyzer": "5.2.1",
"jasmine-core": "3.5.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.3.0",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "2.1.1",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.5.2",
"protractor": "5.4.3",
"ts-node": "8.3.0",
"tslint": "5.18.0",
"typescript": "3.7.5"
}
}
Note sure if this will help in your case, but have you tried increasing the maximumError in the budgets section under configurations in the angular.json file?
Yes, it was a memory issue and I was having a hard time getting node to change the memory limit before it built my project. I was able to get it to allocate 3 gigs and then it worked fine.

ionic env becomes unstable after updating nodejs

My ionic environment becomes unstable after updation nodejs from v8.1 to v12..
Any idea what all i have to update?
[abc]$ ionic cordova emulate android
ng run app:ionic-cordova-build --platform=android
An unhandled exception occurred: Cannot find module '#angular/compiler-cli/src/tooling'
Require stack:
-
- /home/user/workspace1/node_modules/#ngtools/webpack/src/index.js
- /home/user/workspace1/node_modules/#angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/typescript.js
- /home/user/workspace1/node_modules/#angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/index.js
- /home/user/workspace1/node_modules/#angular-devkit/build-angular/src/browser/index.js
- /home/user/workspace1/node_modules/#angular/cli/node_modules/#angular-devkit/architect/node/node-modules-architect-host.js
- /home/user/workspace1/node_modules/#angular/cli/node_modules/#angular-devkit/architect/node/index.js
- /home/user/workspace1/node_modules/#angular/cli/models/architect-command.js
- /home/user/workspace1/node_modules/#angular/cli/commands/run-impl.js
- /home/user/workspace1/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/export-ref.js
- /home/user/workspace1/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/index.js
- /home/user/workspace1/node_modules/#angular/cli/utilities/json-schema.js
- /home/user/workspace1/node_modules/#angular/cli/models/command-runner.js
- /home/user/workspace1/node_modules/#angular/cli/lib/cli/index.js
- /home/user/workspace1/node_modules/#angular/cli/lib/init.js
- /home/user/workspace1/node_modules/#angular/cli/bin/ng
See "/tmp/ng-wzIyd3/angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.
ng run app:ionic-cordova-build --platform=android exited with exit code 127.
Here is package.json
{
"name": "test",
"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": "^8.1.0",
"#angular/core": "^8.1.0",
"#angular/forms": "^8.1.0",
"#angular/http": "^7.2.16",
"#angular/platform-browser": "^8.1.0",
"#angular/platform-browser-dynamic": "^8.1.0",
"#angular/router": "^8.1.0",
"#ionic-native/android-permissions": "^5.27.0",
"#ionic-native/camera": "^5.27.0",
"#ionic-native/core": "^5.26.0",
"#ionic-native/splash-screen": "^5.26.0",
"#ionic-native/status-bar": "^5.26.0",
"#ionic-native/uid": "^5.26.0",
"#ionic-native/unique-device-id": "^5.26.0",
"#ionic/angular": "^5.2.3",
"#ionic/angular-toolkit": "^2.2.0",
"#ionic/pro": "2.0.4",
"cordova-android": "^8.1.0",
"cordova-hot-code-push-plugin": "1.5.3",
"cordova-plugin-android-permissions": "1.0.2",
"cordova-plugin-camera": "4.1.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-file": "6.0.2",
"cordova-plugin-filepath": "1.5.8",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-splashscreen": "^5.0.4",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-unique-device-id2": "2.0.0",
"cordova-plugin-uniquedeviceid": "1.3.2",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sqlite-storage": "5.0.0",
"core-js": "^2.6.11",
"rxjs": "~6.3.3",
"zone.js": "~0.8.29"
},
"devDependencies": {
"#angular-devkit/architect": "^0.1000.3",
"#angular-devkit/build-angular": "^0.1000.3",
"#angular-devkit/core": "^10.0.3",
"#angular-devkit/schematics": "^10.0.3",
"#angular/cli": "^8.3.28",
"#angular/compiler": "^7.2.16",
"#angular/compiler-cli": "^7.2.16",
"#angular/language-service": "^7.2.16",
"#ionic/app-scripts": "^3.2.4",
"#types/jasmine": "^2.8.17",
"#types/jasminewd2": "^2.0.8",
"#types/node": "^10.12.30",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.4",
"ts-node": "^8.0.3",
"tslint": "~5.12.0",
"typescript": "~3.1.6"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-hot-code-push-plugin": {},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-file": {},
"cordova-sqlite-storage": {},
"cordova-plugin-filepath": {},
"cordova-plugin-android-permissions": {}
},
"platforms": []
}
}
Try this:
Update Ionic to the latest version: npm install -g ionic#latest
Remove node_modules folder, then npm install to put it back all the dependencies with the new Ionic version reflected with the updated node version.
#dev.doc ...Highly appreciate your response...
There is change in error,I hope it past the error
npm install #angular/compiler-cli#latest
npm install #angular/cli#latest
which brings to different error now..
> ng run app:ionic-cordova-build --platform=android
An unhandled exception occurred: Object prototype may only be an Object or null: undefined
See "/tmp/ng-ZAbd9i/angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.
ng run app:ionic-cordova-build --platform=android exited with exit code 127.
Re-running this command with the --verbose flag may provide more information.
...details--------
[error] TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf (<anonymous>)
at Object.__extends (../workspace/node_modules/#angular/compiler-cli/node_modules/tslib/tslib.js:68:9)
at ..ion/mygrd/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/template.js:118:17
at ..ion/mygrd/node_modules/#angular/compiler-
My updated package.json reflects the version..it know its slightly higher that your version..
"#angular/cli": "^10.0.3",
"#angular/compiler-cli": "^10.0.4"

Segmentation 11 Error in Node Sass when running a Gulp Task

I've been battling with this issue for the past few hours now and all of the fixes I've found online have unfortunately not worked for me.
When running a gulp task, such as gulp deploy (I'm developing for Netsuite) the task will run until compiling SASS and then I get this error:
/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:14
return a.value;
^
TypeError: Cannot read property 'value' of null
at /Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:14:15
at Array.map (native)
at valuesFromArrayExpression (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:13:26)
at walk.ancestor.CallExpression (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:77:22)
at c (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:47:18)
at Object.skipThrough (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:163:39)
at c (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:46:17)
at Object.base.ExpressionStatement (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:176:5)
at c (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:46:17)
at Object.skipThrough (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:163:39)
Segmentation fault: 11
I've tried removing and re installing the node modules, I've also tried different versions of node, unfortunately I have to use between 4.0.0 - LTS as if defined by the version of Suitecommerce Advanced I'm using.
I'm currently using node 4.9.1 and npm 2.15.11.
Watch tasks run fine, it's only when it's compiling the SCSS for production that this error occurs..
Heres the package.json:
{
"name": "suitecommerce-builder",
"version": "0.0.1",
"description": "Sets of tasks to build a Reference Implementation",
"main": "gulpfile.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"amd-optimize": "0.3.1",
"archiver": "0.13.0",
"async": "0.9.0",
"cli-spinner": "0.1.5",
"del": "0.1.1",
"escodegen": "1.6.1",
"esprima": "1.2.5",
"estraverse": "1.9.3",
"express": "4.13.3",
"glob": "4.0.4",
"gulp": "3.8.7",
"gulp-add": "0.0.2",
"gulp-bless": "3.0.1",
"gulp-changed": "1.0.0",
"gulp-concat": "2.3.3",
"gulp-cssfmt": "^1.0.0",
"gulp-handlebars": "3.0.1",
"gulp-if": "1.2.5",
"gulp-insert": "0.4.0",
"gulp-jshint": "1.9.0",
"gulp-jst": "0.1.1",
"gulp-less": "1.3.6",
"gulp-livereload": "2.1.1",
"gulp-minify-css": "0.3.13",
"gulp-sass": "2.1.0",
"gulp-sourcemaps": "1.2.8",
"gulp-svg2ttf": "1.0.3",
"gulp-ttf2eot": "1.0.1",
"gulp-ttf2woff": "1.0.1",
"gulp-uglify": "0.3.1",
"gulp-util": "3.0.1",
"handlebars": "2.0.0",
"inquirer": "0.5.1",
"is-my-json-valid": "2.13.1",
"jshint-stylish": "1.0.0",
"jsonlint": "1.6.2",
"jsonpath-plus": "0.15.0",
"lazypipe": "0.2.2",
"lodash": "2.4.1",
"map-stream": "0.1.0",
"mime": "1.2.11",
"moment": "2.8.3",
"node-sass": "3.4.1",
"ns-uploader": "file:./ns_npm_repository/ns-uploader",
"progress": "1.1.7",
"q": "1.0.1",
"request": "2.39.0",
"serve-index": "1.7.2",
"shelljs": "^0.5.3",
"short-jsdoc": "0.2.4",
"sourcemap-to-ast": "0.0.2",
"through": "2.3.6",
"through2": "0.6.3",
"underscore": "1.6.0",
"vinyl": "0.4.6",
"xml2js": "0.4.5",
"yargs": "1.3.1",
"credentials-inquirer": "file:./ns_npm_repository/credentials-inquirer",
"suitetalk": "file:./ns_npm_repository/suitetalk4node",
"preconditions": "file:./ns_npm_repository/preconditions",
"xmlbuilder": "8.2.2"
},
"optionalDependencies": {
"minijasminenode2": "1.0.0",
"gulp-jasmine-phantom": "1.1.2",
"fsevents": "0.3.7"
}
}
Any help would be very much appreciated?
Thanks!
I would recommend updating package.json's entry for amd-optimizer. The latest version as shown on https://www.npmjs.com/package/gulp-amd-optimizer is 0.6.0.
And as per https://docs.npmjs.com/cli/update, I'd recommend using the npm update command:
npm update amd-optimizer
You may need to specify the package version, in which case it will be amd-optimizer#0.6.0
Note, npm update also updates the package.json file according to the docs page.
You may need to be in the node_modules directory when running this command.
Hope this helps,

ionic - Confusion about the version

This is my package.json I got from my client:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/animations": "^4.1.3",
"#angular/common": "4.1.3",
"#angular/compiler": "4.1.3",
"#angular/compiler-cli": "4.1.3",
"#angular/core": "4.1.3",
"#angular/forms": "4.1.3",
"#angular/http": "4.1.3",
"#angular/platform-browser": "4.1.3",
"#angular/platform-browser-dynamic": "4.1.3",
"#angular/platform-server": "4.1.3",
"#ionic-native/core": "3.12.1",
"#ionic-native/device": "^3.12.1",
"#ionic-native/file-opener": "^3.12.1",
"#ionic-native/geolocation": "^3.12.1",
"#ionic-native/status-bar": "^3.12.1",
"#ionic/storage": "2.0.1",
"#ng-idle/core": "^2.0.0-beta.8",
"#ng-idle/keepalive": "^2.0.0-beta.8",
"#types/ibm-mobilefirst": "0.0.28",
"#types/jquery": "^3.2.6",
"ajv": "^5.2.2",
"ionic-angular": "^3.5.0",
"ionicons": "3.0.0",
"ng2-translate": "^4.2.0",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"typings": "^2.1.1",
"zone.js": "0.8.12"
},
"devDependencies": {
"#ionic/app-scripts": "^2.0.0",
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-exec": "^0.4.6",
"grunt-file-exists": "^0.1.4",
"grunt-include-replace": "^4.0.1",
"grunt-string-replace": "^1.2.1",
"grunt-template": "^0.2.3",
"typescript": "2.3.4"
},
"cordovaPlugins": [
"ionic-plugin-keyboard",
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "online_registration: An Ionic project"
}
And when I tried npm install, I got this warning:
npm WARN #angular/animations#4.3.6 requires a peer of
#angular/core#4.3.6 but none was installed. npm WARN
#angular/platform-server#4.1.3 requires a peer of
#angular/animations#4.1.3 but none was installed. npm WARN
#ionic-native/splash-screen#3.1.0 requires a peer of
#ionic-native/core#3.1.0 but none was installed. npm WARN
#ionic-native/splash-screen#3.1.0 requires a peer of
#angular/core#2.4.8 but none was installed. npm WARN
#ionic-native/splash-screen#3.1.0 requires a peer of rxjs#5.0.1 but
none was installed. npm WARN grunt-template#0.2.3 requires a peer of
grunt#~0.4.0 but none was installed. npm WARN ng2-translate#4.2.0
requires a peer of #angular/core#^2.0.0 but none was installed. npm
WARN ng2-translate#4.2.0 requires a peer of #angular/http#^2.0.0 but
none was installed.
How critical is this?
Then I check the ionic info:
cli packages: (/Users/xxx/.nvm/versions/node/v6.9.1/lib/node_modules)
#ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 6.4.0
local packages:
#ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.1.2 ios 4.1.1
Ionic Framework : ionic-angular 3.6.0
It seems like it did not follow package.json, which ionic-angular is ^3.5.0. Is this correct?
You just need to delete node_modules folder and after that run npm i.Hope everything will be fine then.

Resources