Ionic 2 构建类型错误:无法读取未定义的属性“AssetUrl”

2023-11-29

Ionic 2 CLI 构建失败给我以下错误:“TypeError:无法读取未定义的属性'AssetUrl'”。

我的研究引导我这个线程 and this one.

两个线程都建议修改“package.json”文件并删除“dependencies”和“devDependencies”中版本前面的“^”符号。

我这样做了,然后 CLI :

  • 离子 rm 平台 android
  • ionic 添加平台 android
  • 最后: ionic 构建 android

我仍然遇到同样的错误。

在某个时刻这个线程,它建议使用一些我还不熟悉的 npm 命令,引用它:“rm -rf node_modules 和 npm 缓存清理和全新的 npm 安装”。我真的不明白这一切的背后是什么.

如果有人想出神奇的解决方案来使构建正常运行,我将不胜感激。但我也想了解“TypeError:无法读取未定义的属性‘AssetUrl’”如何与“package.json”链接?我不明白为什么这个错误会导致可能的解决方案。

我的版本是: npm 3.10.3 节点6.7.0 科尔多瓦 6.3.1 离子2.1.0

这是我的 package.json,它现在看起来是在操作两个线程中读取的建议后的样子:

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/compiler-cli": "0.6.2",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/platform-server": "2.0.0",
    "ionic-angular": "2.0.0-rc.0",
    "ionicons": "3.0.0",
    "@ionic/storage": "1.0.3",
    "ionic-native": "2.0.3",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.21"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.36",
    "typescript": "2.0.3"
  },
  "description": "HelloWorld: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

我在项目文件夹中的 CLI 中做了一个“npm install”+去掉 package.json 中“dependency”和“devDependencies”前面的“^”符号(按照我的问题中链接的论坛主题中的建议) 。它解决了它。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ionic 2 构建类型错误:无法读取未定义的属性“AssetUrl” 的相关文章

随机推荐