Ionic 2 Build TypeError:无法读取未定义的属性'AssetUrl' [英] Ionic 2 Build TypeError: Cannot read property 'AssetUrl' of undefined

查看:105
本文介绍了Ionic 2 Build TypeError:无法读取未定义的属性'AssetUrl'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Ionic 2 failed CLI build giving me the following error: "TypeError: Cannot read property 'AssetUrl' of undefined".

我的研究引导我这个主题这一个

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

我做了然后CLI:


  • ionic rm platform android

  • ionic添加平台android

  • 最后:离子构建android

我仍然得到同样的错误。

I still get the same error.

这个主题,它暗示你唱一些npm命令我还不熟悉(引用它):rm -rf node_modules和npm cache clean以及新的npm install。 我真的不明白所有这些内容是什么

At some point in this thread , it suggests using some npm command I am not familiar with (yet), quoting it: "rm -rf node_modules and npm cache clean and a fresh npm install". I don't really understand what is under the hood of all this.

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

I would be grateful if someone come up with the magic solution to make the build run fine. But also I'd like to understand how "TypeError: Cannot read property 'AssetUrl' of undefined" could be linked with the "package.json"? I don't get why this error lead to that possible solution.

我的版本是:
npm 3.10.3
节点6.7.0
cordova 6.3.1
离子2.1.0

My version are: npm 3.10.3 node 6.7.0 cordova 6.3.1 ionic 2.1.0

这是我的package.json,因为它现在看起来更像是在两个线程中读取建议:

Here is my package.json as it looks now afer operating the suggestion read in both threads:

{
  "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中删除依赖项和devDependencies前面的^符号(如在我的问题链接的论坛帖子中建议)。它解决了它。

I did in CLI within the folder of the projet an "npm install" + take away "^" sign in front of "dependencies" and "devDependencies" in package.json (as advised in the forum threads which are linked in my question). And it solved it.

这篇关于Ionic 2 Build TypeError:无法读取未定义的属性'AssetUrl'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆