将我的节点模块更新到最新版本,包括离子核心等。我收到此错误,我似乎无法找到任何相关信息?有些帮助吗?是否有任何更改为本地通知插件或其他任何可能导致此错误的内容?
[15:34:51] transpile started …
[15:35:10] typescript: D:/ionic/myApp1/src/pages/home/home.ts, line: 13
Expected 1 arguments, but got 2.
L12: this.platform.ready().then(() => {
L13: this.localNoti.on(‘click’, (noti, state) => {
L14: alert(state);
Error: Failed to transpile program
at new BuildError (D:\ionic\myApp1\node_modules@ionic\app-scripts\dist\util
\errors.js:16:28)
at D:\ionic\myApp1\node_modules@ionic\app-scripts\dist\transpile.js:159:20
at new Promise ()
at transpileWorker (D:\ionic\myApp1\node_modules@ionic\app-scripts\dist\tra
nspile.js:107:12)
at Object.transpile (D:\ionic\myApp1\node_modules@ionic\app-scripts\dist\tr
anspile.js:64:12)
at D:\ionic\myApp1\node_modules@ionic\app-scripts\dist\build.js:109:82
答案 0 :(得分:6)
Hesters在Ionic论坛上得到了这个答案:
是的,我经历过同样的事情。像往常一样,Ionic Docs很糟糕 过时的。.on()函数现在返回一个observable。那么你想做什么 用这个替换你的代码:
this.localNotifications.on('click').subscribe(notification => { // Insert your logic here });
这就像修复此错误的魅力一样。
来源链接here