Deploying Vue.js Application to Ubuntu Server
Hello all,
I am working on deploying my first Vue.js application, I have everything working on my dev machine, I created a server and now I am pushing it up to the server and I get this error when I run :
npm run build
Error loading /var/www/html/vue/vue.config.js Error ENOENT: no such file or directory open /root/.aspnet/https/vue.key
This is a vue.js project being built in Visual Studio 2022. with a .Net 6 API for the backend. I have everything working, just deploying it seems to be my current issue I am running into.
vue.config.js
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const baseFolder =
process.env.APPDATA !== undefined && process.env.APPDATA !== ''
? `${process.env.APPDATA}/ASP.NET/https`
: `${process.env.HOME}/.aspnet/https`;
const certificateArg = process.argv.map(arg => arg.match(/--name=(?<value>.+)/i)).filter(Boolean)[0];
const certificateName = certificateArg ? certificateArg.groups.value : "ServiceVue";
if (!certificateName) {
console.error('Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.')
process.exit(-1);
}
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);
module.exports = {
devServer: {
disableHostCheck: true,
https: {
key: fs.readFileSync(keyFilePath),
cert: fs.readFileSync(certFilePath),
},
proxy: {
'^/weatherforecast': {
target: 'https://localhost:5001/'
}
},
port: 5002
}
}
would creating my own self signed cert possibly fix this?
What I have tried:
I have tried changing the config file and when I publish it on my dev machine everything works without any errors. When I do npm run build on my prod server I get this error about .key (certificate I'm assuming) missing.