【问题标题】:Aurelia - getting TypeError: palModule.initialize is not a functionAurelia - 获取 TypeError:palModule.initialize 不是函数
【发布时间】:2018-01-11 19:03:04
【问题描述】:

尝试使用 ASP.NET Core 设置我的第一个 Aurelia Hello World 项目。无法克服上述错误。

3 个文件,index.html、app.html、app.js:

索引.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body aurelia-app>
    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>
    <script>
        System.import("aurelia-bootstrapper");
    </script>
</body>
</html>

app.html:

<template>
    <div>${message}</div>
</template>

app.js:

export class App {
    constructor() {
        this.message = "Hello from Aurelia";
    }
}

ASP.NET Core StartUp.cs:

    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseDefaultFiles();
            app.UseStaticFiles();

            app.Run(async (context) =>
            {
                //await context.Response.WriteAsync("Hello World!");
            });
        }
    }
}

否则一切都是标准的。运行以下命令来安装 Aurelia:

jspm install aurelia-framework
jspm install aurelia-bootstrapper

非常基本但出现错误: Error:

【问题讨论】:

标签: javascript asp.net-core aurelia


【解决方案1】:

我认为您需要运行aurelia-pal-browser,因为这将使我们能够在不同的环境中运行框架。

试试这个代码:

jspm install npm:aurelia-pal-browser

【讨论】:

  • 谢谢!第一次工作。
  • 永远欢迎!
  • +1 我正在阅读 Scott Allen 在 Pluralsight 上使用 Aurelia 构建应用程序的课程,并遇到了同样的问题。我已经使用框架项目构建了 Aurelia 应用程序,但现在尝试从头开始构建一个。
猜你喜欢
  • 2017-06-20
  • 1970-01-01
  • 1970-01-01
  • 2021-09-29
  • 2022-01-03
  • 2018-11-20
  • 2016-12-19
  • 2018-02-15
  • 1970-01-01
相关资源
最近更新 更多