Ionic 2 Build TypeError:无法读取未定义的属性“AssetUrl" [英] Ionic 2 Build TypeError: Cannot read property 'AssetUrl' of undefined
问题描述
Ionic 2 failed CLI 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".
我的研究使我找到了这个帖子和
My research lead me to this thread and this one.
两个线程都建议修改package.json"文件,并去掉dependencies"和devDependencies"中版本前的^"符号.
我这样做了,然后是 CLI:
I did that and then CLI:
- 离子 rm 平台安卓
- 离子添加平台android
- 最后:离子构建 android
我仍然遇到同样的错误.
I still get the same error.
在 的某个时刻这个线程,它建议使用一些我(还)不熟悉的 npm 命令,引用它:rm -rf node_modules and npm cache clean and a fresh 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科尔多瓦 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" + 去掉dependencies"和devDependencies"前面的^"符号package.json (正如我的问题中链接的论坛主题中所建议的那样).它解决了它.
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屋!