ionic 2 构建或运行中的错误
Posted
技术标签:
【中文标题】ionic 2 构建或运行中的错误【英文标题】:Error in ionic 2 build or run 【发布时间】:2018-02-19 14:41:17 【问题描述】:我试图在命令下运行,但给了我打字稿模块错误,如下所示:
ionic cordova run android Error: Cannot find module 'typescript'
请帮我摆脱这个!
以下是我的 inoic 信息输出:
ionic info
cli 包:(/usr/local/lib/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
全局包:
Cordova CLI : 7.0.1
Gulp CLI : CLI version 1.2.2 Local version 3.9.1
本地包:
@ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.6.0
系统:
Android SDK Tools : 25.2.5
Node : v8.4.0
npm : 5.2.0
OS : Linux 3.13
下面是我的 package.json:
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts":
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
,
"dependencies":
"@angular/common": "4.1.3",
"@angular/compiler": "4.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@angular/forms": "4.1.3",
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/camera": "^4.2.1",
"@ionic-native/core": "3.12.1",
"@ionic-native/geolocation": "^4.2.1",
"@ionic-native/keyboard": "^4.1.0",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/sqlite": "^4.2.1",
"@ionic-native/status-bar": "3.12.1",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.6.0",
"ionicons": "3.0.0",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"typescript": "^2.5.2",
"zone.js": "0.8.12"
,
"devDependencies":
"@ionic/app-scripts": "^2.1.4"
,
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"ionic-plugin-keyboard",
"cordova-plugin-splashscreen"
],
"cordovaPlatforms": [],
"description": "checkCookieApp: An Ionic project"
这是我运行的 package.json 文件npm install
【问题讨论】:
明显的基本问题..您是否在您的 ionic 项目中运行此命令? 是的。在 ionic 文件夹本身中 ok.. 你能把你的 package.json 添加到问题中吗? @Suraj,添加 package.json 代码 @RahulMankar 检查此链接中的最后一条评论,看看是否有帮助 - forum.ionicframework.com/t/… 【参考方案1】:通过安装打字脚本\n“
解决了这个问题npm install -g tsd
并创建新的 ionic 2 项目并在下面运行 -
ionic cordova 运行安卓
在同一节点 8.4.0 版本上为我工作。
【讨论】:
以上是关于ionic 2 构建或运行中的错误的主要内容,如果未能解决你的问题,请参考以下文章
尝试生成 ionic 项目的 android 或 ios 构建时出现错误
Ionic 构建/运行 ios 失败,错误代码为 65。如何修复?
Ionic 3 错误:“文件 google-services.json 丢失。没有它,Google 服务插件无法运行。”在 ionic cordova 构建/准备 android