离子2构建或运行时出错

时间:2017-09-11 06:31:41

标签: cordova typescript ionic2

我正在尝试运行下面的命令但是给我下面的打字稿模块错误:

ionic cordova run android
Error: Cannot find module 'typescript'

请帮我摆脱这个!

以下是我的无效信息输出:

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

1 个答案:

答案 0 :(得分:0)

通过安装输入脚本\ n“

解决了这个问题
  

npm install -g tsd

创建新的离子2项目并在下面运行 -

  

离子cordova运行android

在同一节点8.4.0版本上为我工作。