离子模块解析失败,加载模板

时间:2022-02-09 01:09:13

I have worked on a project and after updating the scripts, I find this error. It seems like it is unable to convert the HTML files properly. I've uninstalled ionic reinstalled everything to the latest versions but still giving the same error.

我曾参与过一个项目,在更新了脚本之后,我发现了这个错误。似乎它无法正确地转换HTML文件。我已经卸载了ionic,重新安装到最新版本,但仍然会出现相同的错误。

Module parse failed: /Users/george/dev/flask/rdan/node_modules/@ionic/app-scripts/dist/webpack/loader.js!/Users/george/dev/flask/rdan/src/pages/home/home.ts Unexpected token (20:0) You may need an appropriate loader to handle this file type. | @Component({ | selector: 'page-home',template:/ion-inline-start:"/Users/george/dev/flask/rdan/src/pages/home/home.html"/'\n\n \n

用户模块解析失败:/ /乔治/ dev /瓶/ rdan / node_modules / @ionic / app-scripts / dist / webpack / loader.js ! /用户/乔治/ dev /瓶/ rdan / src /页面/ home /回家。您可能需要一个合适的加载程序来处理这个文件类型。| @Component({| selector: 'page-home',template:/ion-inline-start:"/Users/george/dev/ dev/flask/rdan/src/pages/home/home. "html”/“\ n \ n \ n

This is my ionic info.

这是我的离子信息。

global packages:

全球包:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.5.0

local packages:

本地包:

@ionic/app-scripts              : 2.0.2
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.5.3

System:

系统:

Node       : v6.10.3
OS         : macOS Sierra
Xcode      : Xcode 8.3 Build version 8E162
ios-deploy : 1.9.1
ios-sim    : 5.0.13
npm        : 5.3.0

And this is the package.json file

这就是包装。json文件

{
"name": "rdan",
"version": "0.0.1",
"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/core": "3.12.1",
    "@ionic-native/native-audio": "^4.0.1",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "3.12.1",
    "@ionic/storage": "2.0.1",
    "cordova-android": "^6.2.3",
    "cordova-plugin-console": "^1.0.5",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.2.2",
    "cordova-plugin-whitelist": "^1.3.2",
    "ionic-angular": "3.5.3",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "promise-polyfill": "6.0.2",
    "rxjs": "5.4.0",
    "socket.io-client": "^2.0.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
},
"devDependencies": {
    "@ionic/app-scripts": "2.0.2",
    "@ionic/cli-plugin-cordova": "^1.4.1",
    "@ionic/cli-plugin-ionic-angular": "1.3.2",
    "typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
    "plugins": {
        "cordova-plugin-console": {},
        "cordova-plugin-device": {},
        "cordova-plugin-splashscreen": {},
        "cordova-plugin-statusbar": {},
        "cordova-plugin-whitelist": {},
        "ionic-plugin-keyboard": {}
    },
    "platforms": [
        "android"
    ]
}

}

}

I've tried...

我试过了……

npm uninstall -g ionic
npm uninstall cordova -g
rm -rf node-modules
npm install
npm remove -g cordova
sudo npm install -g cordova

Any ideas? Note: Sorry for my english

什么好主意吗?注意:我的英语不好意思

1 个解决方案

#1


0  

The error reported a position (20: 0) which was commented out in the file home.js, and I was not paying attention thinking that the generated index.js is working etc ...

错误报告了一个位置(20:0),该位置在file home中注释掉了。js,我没有注意到生成的索引。js正在工作……

Finally I removed the code that occupied those lines (which I have already said was commented) and everything works again after two crazy days.

最后,我删除了那些行中的代码(我已经说过被注释了),在疯狂的两天之后,一切又恢复了正常。

#1


0  

The error reported a position (20: 0) which was commented out in the file home.js, and I was not paying attention thinking that the generated index.js is working etc ...

错误报告了一个位置(20:0),该位置在file home中注释掉了。js,我没有注意到生成的索引。js正在工作……

Finally I removed the code that occupied those lines (which I have already said was commented) and everything works again after two crazy days.

最后,我删除了那些行中的代码(我已经说过被注释了),在疯狂的两天之后,一切又恢复了正常。