3

i've gone through Scott Allen's Hello World app, and have my Aurelia app working perfectly in visual studio.

For some reason, I'm unable to get the same result in WebStorm. My index.html body looks like:

<body aurelia-app>
    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>
    <script>
        System.import("aurelia-bootstrapper");        
    </script>
</body>

and I'm met with a console error

Potentially unhandled rejection [3] Error loading "github:aurelia/bootstrapper@0.14.0" at http://localhost:63342/jspm_packages/github/aurelia/bootstrapper@0.14.0.js

the full error looks like:

enter image description here it looks like it's trying to grab a file boostrapper@0.14.0.js, whne that's actually a folder. Why am I unable to get the exact same code working in webstorm as in visual studio?

Here's my bootstrapper section of my config:

"github:aurelia/bootstrapper@0.14.0": {
  "aurelia-event-aggregator": "github:aurelia/event-aggregator@0.6.1",
  "aurelia-framework": "github:aurelia/framework@0.13.2",
  "aurelia-history": "github:aurelia/history@0.6.0",
  "aurelia-history-browser": "github:aurelia/history-browser@0.6.1",
  "aurelia-loader-default": "github:aurelia/loader-default@0.9.0",
  "aurelia-logging-console": "github:aurelia/logging-console@0.6.0",
  "aurelia-router": "github:aurelia/router@0.10.1",
  "aurelia-templating": "github:aurelia/templating@0.13.2",
  "aurelia-templating-binding": "github:aurelia/templating-binding@0.13.0",
  "aurelia-templating-resources": "github:aurelia/templating-resources@0.13.0",
  "aurelia-templating-router": "github:aurelia/templating-router@0.14.0",
  "core-js": "npm:core-js@0.9.18"
},

and running jspm -v yields

C:\Users\Jones\WebstormProjects\Aurelia>jspm -v
0.15.7
Running against global jspm install.
4

3 回答 3

4

看起来它正在尝试获取文件 boostrapper@0.14.0.js,而这实际上是一个文件夹。

实际上应该有一个文件夹一个 .js 像这样:

jspm_packages\github\aurelia\bootstrapper@0.14.0.js // descriptor
jspm_packages\github\aurelia\bootstrapper@0.14.0    // folder

在您的情况下, .js 似乎丢失了。我已经遇到过,但我仍然不确定何时/为什么会发生这种情况,但是当似乎没有其他方法可以解决它时,我只是蛮力......

(假设你提到了visual studio的windows b/c)

打开命令:

cd C:\Users\Jones\WebstormProjects\Aurelia
jspm install aurelia-bootstrapper --force

--force 应该替换丢失的.js:

jspm_packages\github\aurelia\bootstrapper@0.14.0.js

如果该文件存在,请重新启动您的应用程序,您应该一切顺利。

于 2015-07-09T12:51:16.167 回答
3

叹。这与 Aurelia 完全无关,完全与我作为 Web 开发人员的无能有关。

WebStorm 将其服务器托管在http://localhost:port/ProjectName/...

因此,当我在以下路径中添加我的项目名称时config.js

"paths": {
  "*": "*.js",
  "github:*": "Aurelia/jspm_packages/github/*.js",
  "npm:*": "Aurelia/jspm_packages/npm/*.js"
}

这一切都奏效了。

/ProjectName更正确的方法是在运行时添加客户端url jspm init,一切都为您处理。

于 2015-07-09T13:06:16.000 回答
2

您可以检查您的config.js文件并搜索bootstrapper以查看您安装的版本吗?另外请让我知道您在控制台中的 jspm 版本 -

$ jspm -v

只要您的 config.js 中的 bootstrapper 为 0.14.0 并且您的 jspm 是最新版本(不是 beta 版),您应该会很好,如果不告诉我或尝试我们的 gitter 频道 @ http://gitter.im/aurelia /discuss - 如果您没有立即得到解决,请私信我,我们可以解决这个问题,我会更新答案。

于 2015-07-09T02:43:12.687 回答