Getting too many problems when running 'npm install'


#1

Hello,

When I try to run ‘npm install’ on a project it gives me these errors (I know they’re warnings, but the project doesn’t work because of them):

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVers
ion@0. I'll try to do my best with it!
npm WARN @angular/core@2.4.10 requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN ajv-keywords@2.1.0 requires a peer of ajv@>=5.0.0 but none was installed.
npm WARN angular2-jwt@0.1.28 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN angular2-jwt@0.1.28 requires a peer of @angular/http@^2.0.0 but none was installed.
npm WARN angularfire2@2.0.0-beta.7-pre requires a peer of @angular/common@^2.0.0 but none was installed.
npm WARN angularfire2@2.0.0-beta.7-pre requires a peer of @angular/compiler@^2.0.0 but none was installed.
npm WARN angularfire2@2.0.0-beta.7-pre requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN angularfire2@2.0.0-beta.7-pre requires a peer of @angular/platform-browser@^2.0.0 but none was installed.
npm WARN angularfire2@2.0.0-beta.7-pre requires a peer of @angular/platform-browser-dynamic@^2.0.0 but none was installed.
npm WARN @angular/core@2.4.10 requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os
":"win32","arch":"x64"})

Have tried to upgrade/downgrade dependencies locally and globally, but nothing worked. I have tried to upgrade/downgrade node.js, tslint, npm and typescript.
Have also tried to clean the cache.

This is my ionic info:

global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 2.0.2
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : none
    Ionic Framework                 : ionic-angular 3.5.2

System:

    Node       : v6.11.1
    OS         : Windows 8.1
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.3.0

Have been stuck in this for a week without getting any further.

Here are my dependencies:

   "dependencies": {
        "@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",
        "@ionic-native/background-geolocation": "^3.13.1",
        "@ionic-native/core": "^3.12.1",
        "@ionic-native/facebook": "^3.7.0",
        "@ionic-native/geolocation": "^3.4.4",
        "@ionic-native/vibration": "^3.10.3",
        "@ionic/cloud": "^0.15.1",
        "@ionic/cloud-angular": "^0.8.0",
        "@ionic/storage": "2.0.1",
        "@ngrx/core": "^1.2.0",
        "@ngrx/effects": "^2.0.0",
        "@ngrx/store": "^2.2.1",
        "@ngrx/store-devtools": "^3.2.3",
        "angular2-jwt": "^0.1.27",
        "angularfire2": "^2.0.0-beta.7-pre",
        "card.io.cordova.mobilesdk": "^2.1.0",
        "com.paypal.cordova.mobilesdk": "^3.3.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-facebook4": "^1.7.4",
        "cordova-plugin-fcm": "^2.1.1",
        "cordova-plugin-googleplus": "git+https://github.com/EddyVerbruggen/cordova-plugin-googleplus.git",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-mauron85-background-geolocation": "^2.2.5",
        "cordova-plugin-nativestorage": "^2.2.2",
        "@ionic-native/splash-screen": "3.12.1",
        "cordova-plugin-statusbar": "^2.2.1",
        "cordova-plugin-vibration": "^2.1.5",
        "cordova-plugin-whitelist": "^1.3.1",
        "firebase": "^3.9.0",
        "fontawesome": "^4.7.0",
        "install": "^0.8.4",
        "ionic": "^2.1.18",
        "ionic-angular": "3.5.2",
        "ionic-native": "2.2.11",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionic2-rating": "^1.2.2",
        "ionicons": "3.0.0",
        "npm": "^4.0.5",
        "rxjs": "5.4.0",
        "socket.io": "^1.7.2",
        "sw-toolbox": "^3.4.0",
        "ts-md5": "^1.2.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.0.2",
        "@ionic/cli-plugin-cordova": "1.4.1",
        "@ionic/cli-plugin-ionic-angular": "1.3.2",
        "typescript": "2.3.4"
    }

Can anybody tell me why it isn’t working, and what I should do to fix these problems? :slight_smile:


#2

Your copies of Angular Core and Angular Fire are super out of date.

  1. Physically delete, into the recycling bin, node_modules.
  2. In command line: npm cache clean --force
  3. Install nvm-for-windows.
  4. Use nvm to install any version of Node that is the LTS or more recent
  5. Install Ionic and Cordova from scratch in that clean Node install.
  • Do not take any installation steps as administrator. (You might need to give admin permissions to delete node_modules in step 1. That’s the only time you do that. Otherwise a corrupt install will be hard to remove.)

#4

@AaronSterling; Is installing nvm necessarily ? Cause npm worked a week ago. Have done the first 2 steps


#5

No, but it’s one of the strongest possible recommendations I can make when dealing with npm. You can have multiple versions installed at once, switch effortlessly between them, and (most importantly) everything is stored in a single directory in your home that can easily be isolated if any weird corruption happens. I consider @AaronSterling’s suggestions here to be absolutely spot-on.


#6

Then how do I fix the problems I’ve with npm? :slight_smile:


#7

They will probably already be fixed after you uninstall node (which includes npm) and install nvm to install a new node (which will again install a new npm).