Cannot find module “d3” error is displayed after i upgraded my project from ionic 2 to ionic 3

0
down vote
favorite
I just upgraded my from ionic 2 to ionic 3. but now it is stuck at splash screen with error:

Cannot find module “d3”
here is my ionic info :

Cordova CLI: 6.4.0

Ionic Framework Version: 3.0.1

Ionic CLI Version: 2.2.1

Ionic App Lib Version: 2.2.0

Ionic App Scripts Version: 1.3.0

ios-deploy version: Not installed

ios-sim version: Not installed

OS: Windows 10

Node Version: v6.9.1

Xcode version: Not installed

package.json:

{
          "name": "MyApp",
          "author": "",
          "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": { 
             //dependencies starts here. have updated these according to ionic 3
            "@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",
            "@angular/platform-server": "2.2.1",
            "@ionic-native/core": "^3.10.3",
            "@ionic-native/keyboard": "^3.4.4",
            "@ionic-native/splash-screen": "3.4.2",
            "@ionic-native/status-bar": "3.4.2",
            "@ionic/cloud-angular": "^0.10.0",
            "@ionic/storage": "2.0.1",
            "angular2-moment": "^1.1.0",
            "google-libphonenumber": "^2.0.14",
            "ionic-angular": "3.0.1",
            "ionic-gallery-modal": "0.0.7",
            "ionic-native": "2.2.11",
            "ionicons": "3.0.0",
            "rxjs": "5.1.1",
            "sw-toolbox": "3.4.0",
            "zone.js": "^0.8.4"
          },
          "devDependencies": {
            "@ionic/app-scripts": "1.3.0",
            "@ionic/cli-plugin-cordova": "1.1.2",
            "@ionic/cli-plugin-ionic-angular": "1.1.2",
            "typescript": "2.1"
          },
          "cordovaPlugins": [
            "ionic-plugin-keyboard",
            "cordova-plugin-whitelist",
            "cordova-plugin-console",
            "cordova-plugin-statusbar",
            "cordova-plugin-device",
            "cordova-plugin-splashscreen",
            "cordova-sqlite-storage",
            "cordova-plugin-x-toast",
            "cordova-plugin-camera",
            "cordova-plugin-compat",
            "cordova-plugin-image-picker",
            "cordova.plugins.diagnostic",
            {
              "id": "phonegap-plugin-push",
              "locator": "phonegap-plugin-push",
              "variables": {
                "SENDER_ID": "XXXXXXXXXXX"
              }
            },
            "cordova-plugin-appavailability",
            "ionic-plugin-deploy",
            "cordova-plugin-x-socialsharing",
            "cordova-plugin-screen-orientation",
            "com.hutchind.cordova.plugins.streamingmedia",
            "cordova-plugin-contacts",
            "ionic-plugin-deploy",
            "cordova-plugin-x-socialsharing",
            {
              "locator": "https://github.com/napolitano/cordova-plugin-intent",
              "id": "com.napolitano.cordova.plugin.intent"
            },
            "cordova-plugin-screen-orientation",
            "cordova-plugin-file",
            "cordova-plugin-file-transfer"
          ],
          "cordovaPlatforms": [
            {
              "platform": "android",
              "version": "",
              "locator": "android"
            }
          ],
          "description": "An Ionic project"
        }

@devanshsadhotra Can you post your package.json ?

done , please check updated question

Did you remove your old package.json ?

yeah !! i updated it according to ionic 3

you don’t have access to it anymore ?
In your Git?

no, i over wrote that one

i dun push package.json to git

Ok cause you probably deleted some packages lines that don’t exist in the package.json given by Ionic.
Well let’s start by runing the command : npm install d3 --save

You have conflicting ionic-native packages. Get rid of "ionic-native": "2.2.11".

if i do this , then it installs the version of d3 which is not compatible with my code

this did not solve the problem ,for my question

It’s still important to do. You will have other problems if you don’t.

i did it , thanks for suggestion

still this d3 error exists

Which version ? and what is the error message you got ?

it , did not transpile code for d3 and svg i have used

run npm install typings --global
then: typings search --name d3
at last run: typings install d3 --save

Please ignore the previous post. typings has been deprecated in favor of @types/whatever packages managed by npm.

1 Like