Ionic2寻找存在ts文件的js文件

时间:2017-01-10 10:36:47

标签: ionic2

我正在使用Ionic 2,我收到以下错误:

Error: Module build failed: Error: ENOENT: no such file or directory, open
     

'E:\开发\ IDE \离子的应用程式\ theWhoZoo聊天\ SRC \页面\模型\ mapRangeModel.js'           在错误(本机)

如您所见,它正在寻找js文件。但显然在src文件夹下不存在。它具有等效的ts文件。

即。该文件确实存在:

\src\pages\model\mapRangeModel.ts

来自build\main.js

/***/ function(module, exports) {

throw new Error("Module build failed: Error: ENOENT: no such file or directory, open 'E:\\Development\\IDE\\ionic-apps\\theWhoZoo-chat\\src\\pages\\model\\mapRangeModel.js'\n    at Error (native)");

/***/ },

更多信息:

运行ionic serve时,我的CLI中也出现以下错误:

[12:26:34]  watch failed: A watch configured to watch the following paths failed to start. It likely that a file
            referenced does not exist: E:\Development\IDE\ionic-apps\theWhoZoo-chat\src\assets\**\*,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\src\index.html,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\src\manifest.json,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\src\service-worker.js,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\node_modules\ionicons\dist\fonts\**\*,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\node_modules\ionic-angular\fonts\**\*,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\node_modules\ionic-angular\polyfills\polyfills.js,
            E:\Development\IDE\ionic-apps\theWhoZoo-chat\node_modules\sw-toolbox\sw-toolbox.js

离子信息:

Your system information:

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

的package.json

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "@types/googlemaps": "^3.25.42",
    "angular2-moment": "^1.1.0",
    "angularfire2": "^2.0.0-beta.7.1-pre",
    "firebase": "^3.6.4",
    "ionic-angular": "2.0.0-rc.4",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^1.0.0",
    "typescript": "^2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "theWhoZoo-chat: An Ionic project"
}

任何帮助表示感谢。

2 个答案:

答案 0 :(得分:1)

上述错误是由于导入时出现区分大小写问题造成的。

在我的例子中,我正在做以下事情:

import { MapRangeModel } from '../model/maprangeModel';

什么时候应该是:

import { MapRangeModel } from '../model/mapRangeModel';

答案 1 :(得分:0)

在我的情况下,问题在于我已导航至以下项目:

“ C:/用户/.../我的文档/项目1 /”

对于Windows命令提示符来说这没问题,但是为了使ionic正常工作,我必须导航到正确的目录名称和大小写,因为它显示在资源管理器窗口中:

“ C:/ Users /.../ Documents / Project1 /”