【发布时间】:2016-11-10 23:38:52
【问题描述】:
我正在使用 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"(…)
我该怎么做才能解决它?
【问题讨论】:
-
能把main.js的内容发一下吗?
-
当我尝试在 OSX 上运行该项目时也发现了这一点,而该项目以前在 Windows 中运行。完成了 npm 安装等。不知道这是关于什么的
标签: aurelia