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"(…)
我有什麼做的解決呢?
您可以張貼main.js的內容嗎? – amythn04
當我以前在Windows中工作時試圖在OSX上運行項目時,我也發現了這一點。完成一個npm安裝等。不知道這是關於什麼 – kernowcode