2016-09-19 33 views
1

我使用Aurelia CLI和Express创建项目。错误:“主”的脚本错误

我创建了一个名为“public”的文件夹,并且在“public”中还有一个名为“js”的文件夹。 “js”文件夹包含“vendor-bundle.js”和“app-bundle.js”。

我app.js文件具有下面的代码:

app.use(express.static(path.join(__dirname, '/public'))); 

我的index.html:

<body aurelia-app="main"> 
    <script src="js/vendor-bundle.js" data-main="aurelia-bootstrapper">  </script> 
</body> 

我aurelia.json:

{ 
    "name": "master-the-toefl", 
    "type": "project:application", 
    "platform": { 
    "id": "web", 
    "displayName": "Web", 
    "output": "public/js" 
    }, 
    "transpiler": { 
    "id": "babel", 
    "displayName": "Babel", 
    "fileExtension": ".js", 
    "options": { 
     "plugins": [ 
     "transform-es2015-modules-amd" 
     ] 
    }, 
    "source": "src/**/*.js" 
    }, 
    "markupProcessor": { 
    "id": "none", 
    "displayName": "None", 
    "fileExtension": ".html", 
    "source": "src/**/*.html" 
    }, 
    "cssProcessor": { 
    "id": "none", 
    "displayName": "None", 
    "fileExtension": ".css", 
    "source": "src/**/*.css" 
    }, 
    "editor": { 
    "id": "sublime", 
    "displayName": "Sublime" 
    }, 
    "unitTestRunner": { 
    "id": "none", 
    "displayName": "None" 
    }, 
    "paths": { 
    "root": "src", 
    "resources": "src/resources", 
    "elements": "src/resources/elements", 
    "attributes": "src/resources/attributes", 
    "valueConverters": "src/resources/value-converters", 
    "bindingBehaviors": "src/resources/binding-behaviors" 
    }, 
    "build": { 
    "targets": [ 
     { 
     "id": "web", 
     "displayName": "Web", 
     "output": "public/js" 
     } 
    ], 
    "loader": { 
     "type": "require", 
     "configTarget": "vendor-bundle.js", 
     "includeBundleMetadataInConfig": "auto", 
     "plugins": [ 
     { 
      "name": "text", 
      "extensions": [ 
      ".html", 
      ".css" 
      ], 
      "stub": false 
     } 
     ] 
    }, 
    "options": { 
     "minify": "stage & prod", 
     "sourcemaps": "dev & stage" 
    }, 
    "bundles": [ 
     { 
     "name": "app-bundle.js", 
     "source": [ 
      "[**/*.js]", 
      "**/*.{css,html}" 
     ] 
     }, 
     { 
     "name": "vendor-bundle.js", 
     "prepend": [ 
      "node_modules/bluebird/js/browser/bluebird.core.js", 
      "scripts/require.js" 
     ], 
     "dependencies": [ 
      "aurelia-binding", 
      ...... 

它应该工作。然而,我的控制台显示了这些错误:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/public/js/app-bundle.js 

vendor-bundle.js:3297 Error: Script error for "main"(…) 

我有什么做的解决呢?

+0

您可以张贴main.js的内容吗? – amythn04

+0

当我以前在Windows中工作时试图在OSX上运行项目时,我也发现了这一点。完成一个npm安装等。不知道这是关于什么 – kernowcode

回答

0

可能与此问题的GitHub:github issue

这是3天前固定的,所以更新可能会解决您的问题