我在尝试构建时遇到以下错误,并且仅在我尝试访问特定页面(事件页面)时出现。所有其他页面工作正常。抱歉发了这么长的帖子,但我不知道如何解决这个问题。我删除了 ios 和 android 平台 ionic cordova platform rm ios ,清除了 npm 缓存,但什么也没有。
奇怪的是我清理了事件页面,删除了 ios 应用程序 ionic cordova platform rm ios并将其添加回去 ... add ios .什么都没有,错误仍然显示<ion-header no-border [class]="headerBackgroundClass">即使我删除了 [class]="headerBackgroundClass" .那是我清理 npm 缓存的时候。但是还是不行
我不知道还能尝试什么。
我唯一能想到的就是将 ionic webview 更新为 "cordova-plugin-ionic-webview": "^4.0.0",来自 "cordova-plugin-ionic-webview": "^1.1.19",
[12:48:28] ionic-app-script task: "build"
[12:48:28] Error: ./src/pages/event/event Module parse failed: Unexpected token (1:0) You may need an appropriate
loader to handle this file type. | <ion-header no-border [class]="headerBackgroundClass"> | <ion-navbar> |
<ion-title *ngIf="showTitle == true"> @ ./src/pages/event/event.module.ts 9:0-36 @ ./src lazy @
./node_modules/ionic-angular/util/ng-module-loader.js @ ./node_modules/ionic-angular/module.js @
./node_modules/ionic-angular/index.js @ ./src/app/app.module.ts @ ./src/app/main.ts
Error: ./src/pages/event/event
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <ion-header no-border [class]="headerBackgroundClass">
| <ion-navbar>
| <ion-title *ngIf="showTitle == true">
@ ./src/pages/event/event.module.ts 9:0-36
@ ./src lazy
@ ./node_modules/ionic-angular/util/ng-module-loader.js
@ ./node_modules/ionic-angular/module.js
@ ./node_modules/ionic-angular/index.js
@ ./src/app/app.module.ts
@ ./src/app/main.ts
包.json
"dependencies": {
"@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.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@ionic-native/camera": "^4.11.0",
"@ionic-native/core": "4.7.0",
"@ionic-native/crop": "^4.12.0",
"@ionic-native/file": "^4.12.0",
"@ionic-native/google-plus": "^4.20.0",
"@ionic-native/image-resizer": "^4.12.0",
"@ionic-native/in-app-browser": "^4.17.0",
"@ionic-native/native-page-transitions": "^4.18.0",
"@ionic-native/onesignal": "^4.7.0",
"@ionic-native/splash-screen": "4.7.0",
"@ionic-native/status-bar": "^4.7.0",
"@ionic/storage": "2.1.3",
"angularfire2": "5.0.0-rc.6",
"com.telerik.plugins.nativepagetransitions": "^0.6.5",
"cordova-android": "7.1.4",
"cordova-ios": "4.5.5",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-crop": "^0.4.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-googleplus": "7.0.0",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^4.0.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"firebase": "4.12.1",
"info.protonet.imageresizer": "^0.1.1",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"moment": "^2.22.1",
"onesignal-cordova-plugin": "^2.3.3",
"rxjs": "5.5.10",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"config": {
"ionic_source_map": "source-map"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.3",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-camera": {},
"cordova-plugin-crop": {},
"info.protonet.imageresizer": {},
"cordova-plugin-file": {},
"cordova-plugin-inappbrowser": {},
"com.telerik.plugins.nativepagetransitions": {},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "xxx",
"PLAY_SERVICES_VERSION": "11.8.0"
}
},
"platforms": [
"android",
"ios"
]
事件.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { EventPage } from './event';
import { SaferPipe } from '../../pipes/safer.pipe';
import { Underscore } from '../../pipes/underscore.pipe';
import { InAppBrowser } from '@ionic-native/in-app-browser';
import { NativePageTransitions } from '@ionic-native/native-page-transitions';
import { DaysPipe } from '../../pipes/days.pipe';
import { HourPipe } from '../../pipes/hour.pipe';
@NgModule({
declarations: [
EventPage,
SaferPipe,
Underscore,
DaysPipe,
HourPipe
],
providers: [
InAppBrowser,
NativePageTransitions
],
imports: [
IonicPageModule.forChild(EventPage),
],
})
export class EventPageModule { }
编辑***
使用解决方法使其正常工作。创建了一个新组件并移动了代码并进行了微小的更改。现在一切正常。不确定是什么导致了错误。
最佳答案
此消息 Error: ./src/pages/event/event Module parse failed: 让我认为 EventPage 组件错误地引用了它的模板文件。
您的 EventPage 装饰器应如下所示:
@Component({
selector: 'event-page',
templateUrl: 'event.html'
})
export class EventPage {
检查:
.html,例如event.html。.html 扩展名引用模板:templateUrl: 'event.html' 并且不 templateUrl: '事件'关于javascript - ionic 构建错误 - 意外的 token ,缺少适当的加载程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55076696/
大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
鉴于我有以下迁移:Sequel.migrationdoupdoalter_table:usersdoadd_column:is_admin,:default=>falseend#SequelrunsaDESCRIBEtablestatement,whenthemodelisloaded.#Atthispoint,itdoesnotknowthatusershaveais_adminflag.#Soitfails.@user=User.find(:email=>"admin@fancy-startup.example")@user.is_admin=true@user.save!ende
我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test
我收到这个错误:RuntimeError(自动加载常量Apps时检测到循环依赖当我使用多线程时。下面是我的代码。为什么会这样?我尝试多线程的原因是因为我正在编写一个HTML抓取应用程序。对Nokogiri::HTML(open())的调用是一个同步阻塞调用,需要1秒才能返回,我有100,000多个页面要访问,所以我试图运行多个线程来解决这个问题。有更好的方法吗?classToolsController0)app.website=array.join(',')putsapp.websiteelseapp.website="NONE"endapp.saveapps=Apps.order("
似乎无法为此找到有效的答案。我正在阅读Rails教程的第10章第10.1.2节,但似乎无法使邮件程序预览正常工作。我发现处理错误的所有答案都与教程的不同部分相关,我假设我犯的错误正盯着我的脸。我已经完成并将教程中的代码复制/粘贴到相关文件中,但到目前为止,我还看不出我输入的内容与教程中的内容有什么区别。到目前为止,建议是在函数定义中添加或删除参数user,但这并没有解决问题。触发错误的url是http://localhost:3000/rails/mailers/user_mailer/account_activation.http://localhost:3000/rails/mai
我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c
我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file
我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe
在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee