SystemJS(带有 jspm 的 Aurelia)无法加载“aurelia-pal-browser"来自 jspm_packages 文件夹 [英] SystemJS (Aurelia with jspm) fails to load "aurelia-pal-browser" from jspm_packages folder
问题描述
我已按照 https 上的说明进行操作://www.danylkoweb.com/Blog/getting-started-with-aurelia-in-aspnet-mvc-EH,第 3-5 步将 Aurelia 安装到我的 asp.net mvc 核心应用程序中(即运行npm install, jspm init, jspm install aurelia-framework 和 jspm install aurelia-bootstrapper).
I've followed the instructions at https://www.danylkoweb.com/Blog/getting-started-with-aurelia-in-aspnet-mvc-EH, step 3-5 to install Aurelia in to my asp.net mvc core app (i.e. running npm install, jspm init, jspm install aurelia-framework and jspm install aurelia-bootstrapper).
我的启动代码"现在看起来像这样:
My "startup code" just looks like this for now:
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
SystemJS.import('aurelia-bootstrapper');
</script>
当我运行应用程序时,我可以在 Chrome 开发工具上看到很多 Aurelia 资源(js 文件)被加载到/jspm_packages/npm 文件夹下,但我也收到这样的错误:
When I run the application I can see on Chrome dev tools that a lot of Aurelia resources (js files) are loaded under the /jspm_packages/npm folder, but I also get an error like this:
未捕获(承诺)错误:(SystemJS)XHR 错误(404 Not Found)加载 http://localhost:39535/aurelia-pal-browser.js 错误:XHR错误(404 Not Found)加载http://localhost:39535/aurelia-pal-browser.js 加载错误http://localhost:39535/aurelia-pal-browser.js
Uncaught (in promise) Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:39535/aurelia-pal-browser.js Error: XHR error (404 Not Found) loading http://localhost:39535/aurelia-pal-browser.js Error loading http://localhost:39535/aurelia-pal-browser.js
出于某种原因,SystemJS 开始在我的应用程序的根目录中寻找 aurelia-pal-browser.js.我想它找不到 jspm_packages pmaurelia-pal-browser@1.1.0 文件夹,但它在那里并且我在 config.js 文件中有相同的版本号.
For some reason SystemJS starts looking for aurelia-pal-browser.js in the root of my application. I suppose it can't find the jspm_packages pmaurelia-pal-browser@1.1.0 folder but it's there and I have that same version number in the config.js file.
运行 jspm 命令后得到的完整 config.js:
Full config.js as I got it after running the jspm commands:
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: false,
paths: {
"npm:*": "jspm_packages/npm/*"
},
map: {
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@2.0.1",
"aurelia-framework": "npm:aurelia-framework@1.0.8",
"npm:aurelia-binding@1.1.1": {
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0",
"aurelia-task-queue": "npm:aurelia-task-queue@1.1.0"
},
"npm:aurelia-bootstrapper@2.0.1": {
"aurelia-event-aggregator": "npm:aurelia-event-aggregator@1.0.1",
"aurelia-framework": "npm:aurelia-framework@1.0.8",
"aurelia-history": "npm:aurelia-history@1.0.0",
"aurelia-history-browser": "npm:aurelia-history-browser@1.0.0",
"aurelia-loader-default": "npm:aurelia-loader-default@1.0.0",
"aurelia-logging-console": "npm:aurelia-logging-console@1.0.0",
"aurelia-pal": "npm:aurelia-pal@1.2.0",
"aurelia-pal-browser": "npm:aurelia-pal-browser@1.1.0",
"aurelia-polyfills": "npm:aurelia-polyfills@1.1.1",
"aurelia-router": "npm:aurelia-router@1.1.1",
"aurelia-templating": "npm:aurelia-templating@1.1.4",
"aurelia-templating-binding": "npm:aurelia-templating-binding@1.1.0",
"aurelia-templating-resources": "npm:aurelia-templating-resources@1.2.0",
"aurelia-templating-router": "npm:aurelia-templating-router@1.0.1"
},
"npm:aurelia-dependency-injection@1.2.1": {
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-event-aggregator@1.0.1": {
"aurelia-logging": "npm:aurelia-logging@1.2.0"
},
"npm:aurelia-framework@1.0.8": {
"aurelia-binding": "npm:aurelia-binding@1.1.1",
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.2.1",
"aurelia-loader": "npm:aurelia-loader@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0",
"aurelia-path": "npm:aurelia-path@1.1.1",
"aurelia-task-queue": "npm:aurelia-task-queue@1.1.0",
"aurelia-templating": "npm:aurelia-templating@1.1.4"
},
"npm:aurelia-history-browser@1.0.0": {
"aurelia-history": "npm:aurelia-history@1.0.0",
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-loader-default@1.0.0": {
"aurelia-loader": "npm:aurelia-loader@1.0.0",
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-loader@1.0.0": {
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-path": "npm:aurelia-path@1.1.1"
},
"npm:aurelia-logging-console@1.0.0": {
"aurelia-logging": "npm:aurelia-logging@1.2.0"
},
"npm:aurelia-metadata@1.0.3": {
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-pal-browser@1.1.0": {
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-polyfills@1.1.1": {
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-route-recognizer@1.1.0": {
"aurelia-path": "npm:aurelia-path@1.1.1"
},
"npm:aurelia-router@1.1.1": {
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.2.1",
"aurelia-event-aggregator": "npm:aurelia-event-aggregator@1.0.1",
"aurelia-history": "npm:aurelia-history@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-path": "npm:aurelia-path@1.1.1",
"aurelia-route-recognizer": "npm:aurelia-route-recognizer@1.1.0"
},
"npm:aurelia-task-queue@1.1.0": {
"aurelia-pal": "npm:aurelia-pal@1.2.0"
},
"npm:aurelia-templating-binding@1.1.0": {
"aurelia-binding": "npm:aurelia-binding@1.1.1",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-templating": "npm:aurelia-templating@1.1.4"
},
"npm:aurelia-templating-resources@1.2.0": {
"aurelia-binding": "npm:aurelia-binding@1.1.1",
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.2.1",
"aurelia-loader": "npm:aurelia-loader@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0",
"aurelia-path": "npm:aurelia-path@1.1.1",
"aurelia-task-queue": "npm:aurelia-task-queue@1.1.0",
"aurelia-templating": "npm:aurelia-templating@1.1.4"
},
"npm:aurelia-templating-router@1.0.1": {
"aurelia-binding": "npm:aurelia-binding@1.1.1",
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.2.1",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0",
"aurelia-path": "npm:aurelia-path@1.1.1",
"aurelia-router": "npm:aurelia-router@1.1.1",
"aurelia-templating": "npm:aurelia-templating@1.1.4"
},
"npm:aurelia-templating@1.1.4": {
"aurelia-binding": "npm:aurelia-binding@1.1.1",
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.2.1",
"aurelia-loader": "npm:aurelia-loader@1.0.0",
"aurelia-logging": "npm:aurelia-logging@1.2.0",
"aurelia-metadata": "npm:aurelia-metadata@1.0.3",
"aurelia-pal": "npm:aurelia-pal@1.2.0",
"aurelia-path": "npm:aurelia-path@1.1.1",
"aurelia-task-queue": "npm:aurelia-task-queue@1.1.0"
}
}
});
推荐答案
我没有阅读您链接的文章,但您可以尝试安装 aurelia-pal-browser@1.1.0
作为依赖项以及它在您的 package.json
和您的 config.js
中明确列出.
I did not read your linked article, but what you may try is install aurelia-pal-browser@1.1.0
as a dependency as well so it is explicitly listed in your package.json
and your config.js
.
只需在 cmd 行执行以下操作:
Simply execute the following on the cmd line:
jspm install npm:aurelia-pal-browser
这篇关于SystemJS(带有 jspm 的 Aurelia)无法加载“aurelia-pal-browser"来自 jspm_packages 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!