簡體   English   中英

升級到最新節點和npm后,npm我無法正常工作

[英]npm i is not working after upgrading to the latest node and npm

我已經升級了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. 將package.json中的cordova-plugin-badge": "file:node_modules\\\\cordova-plugin-badge替換cordova-plugin-badge": "file:node_modules\\\\cordova-plugin-badge聲明以從npm存儲庫進行打包。
  2. 因此,在升級節點版本時,需要重建本機擴展。 最簡單的方法是刪除node_modules文件夾,清理npm緩存並從頭開始安裝依賴項: rm -rf node_modules && npm cache verify && npm i

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM