Aurelia - 获取TypeError:palModule.initialize不是函数

时间:2017-08-04 00:50:08

标签: javascript asp.net-core aurelia

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

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

的index.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>
&#13;
&#13;
&#13;

app.html:

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

app.js:

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

ASP.NET核心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:

1 个答案:

答案 0 :(得分:1)

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

试试这段代码:

jspm install npm:aurelia-pal-browser