npm升级到最新节点和npm后我没有工作

时间:2018-06-14 07:28:59

标签: node.js angular typescript npm ionic3

我已升级nodenpm。现在ionic 33.9.2)项目(在升级到node和npm之前工作正常)对npm i不起作用。但它适用于新项目。你能告诉我如何解决这个问题吗?

  

节点:8.11.2

     

npm:5.6.0

尝试使用npm i

时出现错误
npm WARN deprecated highcharts-more@0.1.2: this package has been deprecated, just import modules from the highcharts folder
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules\cordova-plugin-badge" 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\lokuge\AppData\Roaming\npm-cache\_logs\2018-06-14T07_15_19_651Z-debug.log

其他信息: 由于这是一个旧项目,因此没有package-lock.json。它只有package.json

的package.json

{
    "name": "Test",
    "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": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "5.0.0",
        "@angular/compiler": "5.0.0",
        "@angular/compiler-cli": "5.0.0",
        "@angular/core": "5.0.0",
        "@angular/forms": "5.0.0",
        "@angular/http": "5.0.0",
        "@angular/platform-browser": "5.0.0",
        "@angular/platform-browser-dynamic": "5.0.0",
        "@ionic-native/app-rate": "4.5.3",
        "@ionic-native/call-number": "4.3.3",
        "@ionic-native/camera": "4.3.2",
        "@ionic-native/contacts": "4.3.3",
        "@ionic-native/core": "4.3.3",
        "@ionic-native/facebook": "4.5.3",
        "@ionic-native/file": "4.5.3",
        "@ionic-native/file-opener": "4.5.3",
        "@ionic-native/firebase": "4.5.3",
        "@ionic-native/globalization": "4.5.3",
        "@ionic-native/google-plus": "4.5.3",
        "@ionic-native/in-app-browser": "^4.6.0",
        "@ionic-native/local-notifications": "4.5.3",
        "@ionic-native/network": "4.5.3",
        "@ionic-native/screen-orientation": "4.4.2",
        "@ionic-native/social-sharing": "4.3.3",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic/storage": "2.1.3",
        "@types/papaparse": "4.1.33",
        "angular2-text-mask": "8.0.2",
        "angularfire2": "5.0.0-rc.6",
        "call-number": "^1.0.1",
        "cordova-android": "^6.3.0",
        "cordova-ios": "4.5.4",
        "cordova-plugin-apprate": "1.3.0",
        "cordova-plugin-badge": "file:node_modules\\cordova-plugin-badge",
        "cordova-plugin-camera": "2.4.1",
        "cordova-plugin-compat": "1.2.0",
        "cordova-plugin-contacts": "2.3.1",
        "cordova-plugin-device": "1.1.7",
        "cordova-plugin-dialogs": "2.0.1",
        "cordova-plugin-facebook4": "1.9.1",
        "cordova-plugin-file": "4.3.3",
        "cordova-plugin-file-opener2": "2.0.19",
        "cordova-plugin-firebase": "0.1.25",
        "cordova-plugin-globalization": "1.0.9",
        "cordova-plugin-googleplus": "5.2.1",
        "cordova-plugin-inappbrowser": "1.7.2",
        "cordova-plugin-ionic-webview": "1.1.16",
        "cordova-plugin-local-notification": "0.9.0-beta.2",
        "cordova-plugin-network-information": "2.0.1",
        "cordova-plugin-screen-orientation": "2.0.2",
        "cordova-plugin-splashscreen": "4.1.0",
        "cordova-plugin-statusbar": "2.3.0",
        "cordova-plugin-whitelist": "1.3.3",
        "cordova-plugin-x-socialsharing": "5.2.1",
        "cordova-sqlite-storage": "2.1.2",
        "es6-promise-plugin": "4.1.0",
        "firebase": "4.8.2",
        "highcharts": "6.0.2",
        "highcharts-more": "0.1.2",
        "ionic-angular": "3.9.2",
        "ionic-img-viewer": "2.7.3",
        "ionic-plugin-keyboard": "2.2.1",
        "ionic2-rating": "1.2.2",
        "ionicons": "3.0.0",
        "lodash": "4.17.5",
        "moment": "2.19.3",
        "mx.ferreyra.callnumber": "0.0.2",
        "ng2-truncate": "1.3.11",
        "papaparse": "4.3.7",
        "rxjs": "5.5.2",
        "sw-toolbox": "3.6.0",
        "text-mask-addons": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.1.8",
        "typescript": "2.4.2"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-sqlite-storage": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-camera": {
                "CAMERA_USAGE_DESCRIPTION": " ",
                "PHOTOLIBRARY_USAGE_DESCRIPTION": " "
            },
            "cordova-plugin-contacts": {
                "CONTACTS_USAGE_DESCRIPTION": " "
            },
            "cordova-plugin-x-socialsharing": {},
            "mx.ferreyra.callnumber": {},
            "call-number": {},
            "cordova-plugin-screen-orientation": {},
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-firebase": {},
            "cordova-plugin-apprate": {},
            "cordova-plugin-file": {},
            "cordova-plugin-file-opener2": {},
            "cordova-plugin-local-notification": {},
            "cordova-plugin-facebook4": {
                "APP_ID": "247328495802670",
                "APP_NAME": "Budget My Reno"
            },
            "cordova-plugin-googleplus": {
                "REVERSED_CLIENT_ID": "com.googleusercontent.apps.593814858306-cd06l64ddacucewsde34aqw22nb"
            },
            "cordova-plugin-globalization": {},
            "cordova-plugin-compat": {},
            "cordova-plugin-network-information": {}
        },
        "platforms": [
            "android",
            "ios"
        ]
    }
}

1 个答案:

答案 0 :(得分:3)

你需要做两件事:

  1. 将package.json中的cordova-plugin-badge": "file:node_modules\\cordova-plugin-badge声明替换为npm存储库中的包。
  2. 因此,在升级节点版本时,您需要重建本机扩展。最简单的方法是删除node_modules文件夹,清理npm缓存并从头开始安装依赖项:rm -rf node_modules && npm cache verify && npm i