Javascript error in simple Aurelia ASP.Net 5.0 RC1 Setup

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 07:36:19

问题


I am attempting to setup a very basic Aurelia project in ASP.Net 5.0 RC1. I am getting the following JavaScript error after doing a basic initial setup. I am using TypeScript.

Unhandled promise rejection Error: XHR error (404 Not Found) loading  http://localhost:5392/core-js.js
    Error loading http://localhost:5392/core-js.js as "core-js" from http://localhost:5392/jspm_packages/npm/aurelia-loader@1.0.0-beta.1/aurelia-loader.js
    at o (http://localhost:5392/jspm_packages/system.js:4:12694)
    at XMLHttpRequest.s.onreadystatechange (http://localhost:5392/jspm_packages/system.js:4:13219)
    (anonymous function) @ es6.promise.js:138

The setup I did is as follows.

  1. Create Empty ASP.Net 5.0 template.
  2. Install Microsoft.AspNet.StaticFiles from nuget and set up app.UseFileServer.
  3. From git bash run jspm init with the following settings.

    Package.json file does not exist, create it? [yes]: Would you like jspm to prefix the jspm package.json properties under jspm? [yes]: Enter server baseURL (public folder path) [./]:./wwwroot Enter jspm packages folder [wwwroot\jspm_packages]: Enter config file path [wwwroot\config.js]: Configuration file wwwroot\config.js doesn't exist, create it? [yes]: Enter client baseURL (public folder URL) [/]: Do you wish to use a transpiler? [yes]: Which ES6 transpiler would you like to use, Babel, TypeScript or Traceur? [babel]:typescript

  4. From git bash run jspm install aurelia-framework and jspm install aurelia-bootstrapper.

  5. Add the index.html, app.html, and app.ts file from the aurelia docs.
  6. Fire up IIS Express, load page, get error.

Is there a step I am missing in this setup?


回答1:


It seems like this is a known issue. The fix is somewhat simple. If you add a core-js mapping at the top of the map section in config.js, it fixes it.

For example,

map: {
    "core-js": "npm:core-js@1.2.6",
    // other mappings
}


来源:https://stackoverflow.com/questions/34032054/javascript-error-in-simple-aurelia-asp-net-5-0-rc1-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!