模板错误ENOENT:运行离子服务-l时没有此类文件或目录

时间:2018-07-17 06:23:39

标签: angular cordova ionic-framework angular5

我将Angular 5项目合并到Ionic 3框架中,并且还更新了editor.json。之后,我运行命令npm install来创建node_modules。但是,在运行命令ionic serve -l之后,我看到以下错误:

  

模板错误,“ / var / www / html / githubIonic / dist / out-tsc / src / app / app.component.html”:错误:ENOENT:否这样               文件或目录,打开'/var/www/html/githubIonic/dist/out-tsc/src/app/app.component.html'

我错过了什么吗?

以下是我的离子信息:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v9.11.1
    npm  : 6.2.0 
    OS   : Linux 4.4

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

这是package.json:

{
  "name": "githubIonic",
  "version": "0.0.1",
  "main":"main.ts",
  "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",
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "dependencies": {
    "@angular-devkit/core": "^0.2.0",
    "@angular/animations": "5.2.10",
    "@angular/common": "5.2.10",
    "@angular/compiler": "5.2.10",
    "@angular/compiler-cli": "5.2.10",
    "@angular/core": "5.2.10",
    "@angular/forms": "5.2.10",
    "@angular/http": "5.2.10",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "4.9.1",
    "@ionic-native/splash-screen": "4.9.1",
    "@ionic-native/status-bar": "4.9.1",
    "@ionic/storage": "2.1.3",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "rxjs": "5.5.10",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.10",
    "typescript": "~2.6.2",
    "@angular/cli": "^1.7.4",
    "@angular/compiler-cli": "^5.2.10",
    "@angular/language-service": "^5.2.10",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.106",
    "codelyzer": "^4.2.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.2",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0"
  },
  "description": "An Ionic project"
}

1 个答案:

答案 0 :(得分:0)

猜想您需要全局安装ionic,然后再进行app-scripts安装。使用以下命令,

sudo npm install -g ionic@latest
sudo npm install @ionic/app-scripts@latest

希望这会有所帮助!。