找不到模块" d3"我将项目从离子2升级到离子3后显示错误

时间:2017-05-23 12:37:52

标签: d3.js ionic-framework ionic2 ionic3

我刚刚将离子2从离子2升级到离子3.但是现在它停留在启动画面时出现错误:

  

无法找到模块" d3"

这是我的离子信息:

  

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"
        }

关注升级的this链接

2 个答案:

答案 0 :(得分:8)

将d3安装到package.json。

npm install d3 --save

从npm:

安装类型声明
npm install @types/d3 --save-dev

你不需要打字。它已被弃用。

jquery也一样。

答案 1 :(得分:1)

使用以下一组命令来解决:

npm install d3@vSpecify_your_version --save
npm install -g typings --save
typings search d3 --save
typings install d3 --save
npm install jquery --save
typings install dt~jquery --global --save
npm install aws-sdk --save

然后删除项目的node_modules文件夹,并在项目CMD / Terminal中执行npm install。