npm 发生未处理的异常:找不到模块"node:fs"

xurqigkl  于 2023-03-08  发布在  其他
关注(0)|答案(2)|浏览(196)

当我运行离子生成页面,我得到了这个错误:

An unhandled exception occurred: Cannot find module 'node:fs'

它发生后,我改变了我的节点js版本14.15.0.我忘了什么版本的节点js,我用之前.我找不到任何地方解决这个问题.我一直试图改变节点版本到其他版本,但它只是给了我新的不同类型的错误.
这是我的软件包。json看起来像

{
  "name": "sbh_mobile",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~12.0.1",
    "@angular/core": "~12.0.1",
    "@angular/forms": "~12.0.1",
    "@angular/platform-browser": "~12.0.1",
    "@angular/platform-browser-dynamic": "~12.0.1",
    "@angular/router": "~12.0.1",
    "@auth0/angular-jwt": "^5.0.2",
    "@awesome-cordova-plugins/core": "^5.41.0",
    "@awesome-cordova-plugins/device": "^5.45.0",
    "@awesome-cordova-plugins/geolocation": "^5.45.0",
    "@awesome-cordova-plugins/in-app-browser": "^5.46.0",
    "@awesome-cordova-plugins/ionic-webview": "^6.2.0",
    "@awesome-cordova-plugins/native-geocoder": "^5.45.0",
    "@awesome-cordova-plugins/onesignal": "^5.44.0",
    "@awesome-cordova-plugins/screen-orientation": "^6.2.0",
    "@capacitor-community/background-geolocation": "git+https://github.com/pdrhlik/background-geolocation.git",
    "@capacitor-community/camera-preview": "^3.1.2",
    "@capacitor/android": "3.3.1",
    "@capacitor/app": "1.0.2",
    "@capacitor/camera": "^1.2.4",
    "@capacitor/core": "^3.3.1",
    "@capacitor/haptics": "1.0.2",
    "@capacitor/keyboard": "^1.0.1",
    "@capacitor/local-notifications": "^1.1.0",
    "@capacitor/network": "^1.0.7",
    "@capacitor/splash-screen": "^1.2.2",
    "@capacitor/status-bar": "^1.0.2",
    "@capacitor/storage": "^1.2.3",
    "@capgo/native-market": "^1.1.11",
    "@coreui/angular": "^4.2.14",
    "@coreui/coreui": "^4.2.2",
    "@ionic-native/aes-256": "^5.36.0",
    "@ionic-native/android-permissions": "^5.36.0",
    "@ionic-native/app-version": "^5.36.0",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/fingerprint-aio": "^5.36.0",
    "@ionic-native/google-plus": "^5.36.0",
    "@ionic-native/in-app-browser": "^5.36.0",
    "@ionic-native/native-storage": "^5.36.0",
    "@ionic-native/themeable-browser": "^4.20.0",
    "@ionic-native/uid": "^5.36.0",
    "@ionic-native/unique-device-id": "^5.36.0",
    "@ionic/angular": "^6.3.7",
    "@ionic/core": "^6.0.2",
    "@ionic/pwa-elements": "^3.1.1",
    "@ionic/storage": "^3.0.6",
    "@ionic/vue": "^6.0.1",
    "@ionic/vue-router": "^6.0.1",
    "bootstrap": "^5.2.2",
    "cordova-plugin-aes256-encryption": "^2.0.1",
    "cordova-plugin-android-permissions": "^1.1.2",
    "cordova-plugin-app-version": "^0.1.14",
    "cordova-plugin-device": "^2.1.0",
    "cordova-plugin-fingerprint-aio": "^5.0.1",
    "cordova-plugin-geolocation": "^4.1.0",
    "cordova-plugin-googleplus": "^8.5.2",
    "cordova-plugin-inappbrowser": "^5.0.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-nativegeocoder": "^3.4.1",
    "cordova-plugin-screen-orientation": "^3.0.2",
    "cordova-plugin-uid": "^1.3.0",
    "cordova-sqlite-storage": "^6.0.0",
    "crypto-js": "^4.1.1",
    "es6-promise-plugin": "^4.2.2",
    "google-libphonenumber": "^3.2.27",
    "ionic-keyboard-assist": "^4.0.2",
    "jsqr": "^1.4.0",
    "lottie-web": "^5.10.1",
    "ngx-lottie": "^7.0.4",
    "ngx-pagination": "^6.0.2",
    "ngx-pipes": "^2.7.6",
    "onesignal-cordova-plugin": "^3.1.1",
    "rxjs": "~6.6.0",
    "swiper": "^8.4.4",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.0.1",
    "@angular-eslint/builder": "~12.0.0",
    "@angular-eslint/eslint-plugin": "~12.0.0",
    "@angular-eslint/eslint-plugin-template": "~12.0.0",
    "@angular-eslint/template-parser": "~12.0.0",
    "@angular/cli": "~12.0.1",
    "@angular/compiler": "~12.0.1",
    "@angular/compiler-cli": "~12.0.1",
    "@angular/language-service": "~12.0.1",
    "@capacitor/cli": "^3.9.0",
    "@ionic/angular-toolkit": "^8.0.0",
    "@ionic/lab": "3.2.10",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~3.7.1",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.2.4"
  },
  "description": "An Ionic project"
}

请你帮我解决这个问题...谢谢

hrysbysz

hrysbysz1#

感谢所有的帮助。幸运的是我有我的项目的旧文件夹。我匹配所有的devdependencies版本。我找到了我的版本
@ionic/angular-toolkit在我的旧文件夹中是^4.0.0,新文件夹是^6.0.0。我不知道它是如何变化的。但我已经将它降级到4.0.0,ionic g页面现在工作正常.....

dgiusagp

dgiusagp2#

您需要删除节点模块文件夹并运行npm i,这将生成一个包含更新后的节点版本的新节点文件夹。

相关问题