简体   繁体   English

Ionic 2 Build TypeError:无法读取未定义的属性'AssetUrl'

[英]Ionic 2 Build TypeError: Cannot read property 'AssetUrl' of undefined

Ionic 2 failed CLI build giving me the following error: "TypeError: Cannot read property 'AssetUrl' of undefined". Ionic 2 CLI构建失败,给出了以下错误:“TypeError:无法读取未定义的属性'AssetUrl'”。

My research lead me to this thread and this one . 我的研究引导我到这个线程这一个

Both threads suggest to modify the "package.json" file and to remove the "^" sign in front of the version in "dependencies" and "devDependencies". 两个线程都建议修改“package.json”文件并删除“dependencies”和“devDependencies”中版本前面的“^”符号。

I did that and then CLI: 我这样做然后CLI:

  • ionic rm platform android 离子rm平台android
  • ionic add platform android 离子添加平台android
  • and finally: ionic build android 最后:离子构建android

I still get the same error. 我仍然得到同样的错误。

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". 这个线程的某个时刻,它建议使用一些我不熟悉的npm命令,引用它:“rm -rf node_modules和npm cache clean以及新的npm install”。 I don't really understand what is under the hood of all this . 我真的不明白这一切是什么

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"? 但我还想了解“TypeError:无法读取未定义的属性'AssetUrl'”是如何与“package.json”链接的? I don't get why this error lead to that possible solution. 我不明白为什么这个错误会导致这种可能的解决方案。

My version are: npm 3.10.3 node 6.7.0 cordova 6.3.1 ionic 2.1.0 我的版本是:npm 3.10.3节点6.7.0 cordova 6.3.1离子2.1.0

Here is my package.json as it looks now afer operating the suggestion read in both threads: 这是我的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": []
}

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). 我在projet的文件夹中的CLI中执行了“npm install”+在package.json中的“dependencies”和“devDependencies”前面删除“^”符号(在我的问题中链接的论坛帖子中建议) 。 And it solved it. 它解决了它。

You should also update @angular/compiler-cli to the latest version. 您还应该将@ angular / compiler-cli更新到最新版本。

That should do the trick 这应该够了吧

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 2 - 无法读取未定义的属性'AssetUrl' - Angular 2 - Cannot read property 'AssetUrl' of undefined 离子包由于类型错误而导致Android FAILED失败:无法读取未定义的属性“长度” - ionic package build android FAILED due to TypeError: Cannot read property 'length' of undefined iOs 构建失败 - UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“toLowerCase” - iOs build failing - UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined Angular Build - 未捕获的类型错误:无法读取未定义的属性“id” - Angular Build - Uncaught TypeError: Cannot read property 'id' of undefined UnhandledPromiseRejectionWarning TypeError:无法读取未定义的属性“属性” - UnhandledPromiseRejectionWarning TypeError: Cannot read property 'property' of undefined Microsoft NodeJS从零到英雄:找不到模块'../build/Release/bson'和TypeError:无法读取未定义的属性'indexOf' - Microsoft NodeJS Zero to Hero: Cannot find module '../build/Release/bson' and TypeError: Cannot read property 'indexOf' of undefined TypeError:无法读取未定义的属性“重新生成” - TypeError: Cannot read property 'regenerate' of undefined “TypeError:无法读取属性'apply'of undefined” - “TypeError: Cannot read property 'apply' of undefined” 类型错误:无法读取未定义的属性“节点” - TypeError: Cannot read property 'node' of undefined TypeError:无法读取未定义的属性“状态” - TypeError: Cannot read property 'state' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM