{
"name": "vue_node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.16.2",
"express-vue": "^4.0.13",
"sqlite3": "^3.1.13",
"vue": "^2.3.4"
}
}
const express = require('express');
const expressVue = require('express-vue');
const path = require('path');
const app = express();
app.use(expressVue.init({
rootPath: path.join(__dirname, 'app')
}));
app.set('view engine', 'vue');
app.set('views', path.join(__dirname, 'app'));
app.set('vue', {
componentsDir: path.join(__dirname, 'app/components')
});
app.use(express.static(path.join(__dirname, 'assets')))
app.get('/', (req, res) => {
res.renderVue('App');
});
app.listen(3000, () => {
console.log('Server started on port 3000')
});
<template>
<div id="app">
<HelloWorld />
</div>
</template>
<script>
import HelloWorld from 'HelloWorld'
export default {
name: 'app',
components: {
HelloWorld
}
}
</script>
<style>
</style>
<template>
<div>
<h1>Hello World</h1>
</div>
</template>
<script>
export default {
name: 'HelloWorld'
}
</script>
<style>
</style>
{ Error: Cannot find module 'HelloWorld'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (App:7:19)
at Module._compile (module.js:635:30)
at d:\Projects\Javascript\vue_node\node_modules\express-vue-renderer\lib\utils\require.js:239:15
at new Promise (<anonymous>)
at Object.requireFromString (d:\Projects\Javascript\vue_node\node_modules\express-vue-renderer\lib\utils\require.js:171:12)
at d:\Projects\Javascript\vue_node\node_modules\express-vue-renderer\lib\parser\script.js:69:23 code: 'MODULE_NOT_FOUND' }