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

时间:2016-10-23 19:08:45

标签: node.js npm ionic2

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

我的研究引导我this threadthis one

两个主题都建议修改" package.json"文件并删除" ^"在"依赖关系"中签署版本。和" devDependencies"。

我做了然后CLI:

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

我仍然得到同样的错误。

this thread的某个时刻,它建议使用一些我不熟悉的npm命令,引用它:" rm -rf node_modules和npm cache clean以及新的npm install&#34 ;。 我真的不明白所有这些内容是什么

如果有人拿出神奇的解决方案让构建运行正常,我将不胜感激。但我也想了解如何" 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": []
}

2 个答案:

答案 0 :(得分:6)

我在CLI中的项目文件夹中执行了" npm install" +带走" ^"签署"依赖"和" devDependencies"在package.json中(在我的问题中链接的论坛帖子中建议)。它解决了它。

答案 1 :(得分:2)

您还应该将@ angular / compiler-cli更新为最新版本。

应该做的伎俩