Nuxtjs Error FATAL listen EADDRNOTAVAIL domain:8000 - web-deployment

I follow this link https://github.com/pi0/nuxt-plesk-example to deploy Nuxtjs project into Plesk shared host but when I want to start my project in production mode I run script command start then I have this error
Note: I didn't set any ENV variable.
project-frontend#1.0.0 start /var/www/vhosts/[domain].org/[domain].org
> nuxt start
FATAL listen EADDRNOTAVAIL [domain]:8000
at Server.setupListenHandle [as _listen2] (net.js:1343:19)
at listenInCluster (net.js:1401:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1510:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:72:10)
tput: No value for $TERM and no -T specified
╭───────────────────────────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
│ │
│ Error: listen EADDRNOTAVAIL [domain]:8000 │
│ │
╰───────────────────────────────────────────────────╯
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! iwa-frontend#1.0.0 start: `nuxt start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the iwa-frontend#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /var/www/vhosts/[domain].org/.npm/_logs/2019-08-07T07_46_00_876Z-debug.log
and this is my server.js file in root directory
const express = require('express');
const { Nuxt, Builder } = require('nuxt');
const config = require('./nuxt.config.js');
// Create new express app
const app = express();
// Listen to port 3000 or PORT env if provided
app.listen(process.env.PORT || 8000);
// Enable production mode
config.dev = false;
// Create instance of nuxt
const nuxt = new Nuxt(config);
and this is my nuxt.config.js
import colors from "vuetify/es5/util/colors";
export default {
mode: "universal",
/*
** Headers of the page
*/
server: {
port: 8000, // default: 3000
host: '[domain-name].org', // default: localhost
},
head: {
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{
hid: "description",
name: "description",
content: process.env.npm_package_description || ""
}
],
link: [
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
{
rel: "stylesheet",
href:
"https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"
}
]
},
/*
** Customize the progress-bar color
*/
loading: { color: "#fff" },
/*
** Global CSS
*/
css: ["~/assets/main.css"],
router: {
middleware: "i18n"
},
/*
** Plugins to load before mounting the App
*/
plugins: [
"~/plugins/mdi-font.js",
"~/plugins/i18n.js",
"~/plugins/axios.js",
{ src: "~/plugins/flag.js", ssr: false }
],
/*
** Nuxt.js modules
*/
modules: [
"#nuxtjs/vuetify",
// Doc: https://axios.nuxtjs.org/usage
"#nuxtjs/axios"
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {},
/*
** vuetify module configuration
** https://github.com/nuxt-community/vuetify-module
*/
vuetify: {
theme: {
primary: colors.blue.darken2,
accent: colors.grey.darken3,
secondary: colors.amber.darken3,
info: colors.teal.lighten1,
warning: colors.amber.base,
error: colors.deepOrange.accent4,
success: colors.green.accent3
}
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {}
}
};
What should I do?
Thanks

You have two options:
NUXT_HOST=0.0.0.0
or
server: {
host: "0.0.0.0"
}
in nuxt.config.ts

Related

Missing required argument `file|environment' - PM2

I am trying to launch my nextjs app through PM2. I have configured PM2 in ecosystem.config.js file and starting my nextjs app as pm2 start my-app. That's work perfectly fine.
Now I also want PM2 to pull from my github repo then run a custom script that I provided undeer post-deploy key. After setting up my github repo through ssh, I tried to run PM2 as pm2 deploy but that gives me following error
error: missing required argument 'file|environment'
ecosystem.config.js
module.exports = {
apps: [
{
name: 'next-app',
script: 'npm run start',
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
}
}
],
deploy: {
production: {
user: 'ubuntu',
host: ["123.12.12.123"],
key: '~/.ssh/id_ed25519.pub',
ssh_options: 'ForwardAgent=yes',
ref: 'origin/branch-12',
repo: 'git#github.com:my-username/my-repo.git',
path: '/var/www/my-project/',
'pre-deploy': "git fetch --all && git reset --hard origin/branch-12",
'post-deploy': 'sh nextjs-pm2-deploy.sh'
}
}
};

Using MUP returned a container error

When I used the following config deploying to digitalocean, I did a $ mup setup with no errors and then ran $ mup deploy and everything went well until it tried to prepare bundle...what am I missing here?
This is the error I'm getting with the following config when deploying...
module.exports = {
servers: {
one: {
host: 'xxx.xxx.xxx.xxx',
username: 'root',
pem: "~/.ssh/id_rsa"
}
},
app: {
name: 'hotel',
path: '../hotel',
// this is my local path to the application root
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: 'http://xxx.xxx.xxx.xxx',
MONGO_URL: 'mongodb://localhost/meteor',
},
docker: {
image: 'abernix/meteord:base',
},
// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true
},
mongo: {
version: '3.4.1',
servers: {
one: {}
}
}
};

Webpack 2 minify css

this is my first webpack configuration. I'm using webpack 2 but I cannot generate a main.min.css.
The file main.css contain a plain css (no sass/scss/less etc..).
//main.css
body {
width: 100% !important;
height: 100% !important;
}
This is my webpack.config.js:
const style = require('./public/assets/css/main.css');
const path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader'
options: {
minimize: true
}
}
]
}
]
},
entry: './public/assets/js/main.js',
output: {
filename: 'main.min.js',
path: path.resolve(__dirname, 'dist')
}
};
When I run webpack, I got this message:
..\PersonalWebsite\public\assets\css\main.css:1
(function (exports, require, module, __filename, __dirname) { body {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\PersonalProjects\PersonalWebsite\webpack.config.js:1:77)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! personalwebsite#1.0.0 build: `webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the personalwebsite#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Bock\AppData\Roaming\npm-cache\_logs\2017-12-24T11_04_39_704Z-debug.log
I'm not able to understand what is wrong. I'm ready the documentation about webpack but I think there is something in the configuration that not work.
Please try to do this
change your webpack.config.js to this code
var path = require("path");
module.exports = {
entry: {
app: ['./public/assets/js/main.js','./public/assets/css/main.css']
},
output: {
path: path.resolve(__dirname, "dist"),
publicPath: "/dist/",
filename: "main.min.js"
},
watch:true,
module:{
loaders:[
{test: /\.css$/,loader: "style-loader!css-loader"},
]
}
};
Don't forget to remove the require('./public/assets/css/main.css'); from your main.js

ng build --prod --aot --preserve-symlinks give Module not found for lazy load module from extenal link package

I am new to AOT build and angular2 deployments.
I am using Angular 2 with Node # 6.11.0, NPM # 4.6.1 and #Angular/CLI # 1.4.2
I have two projects where one is the host application (UI-Host) and the other is the actual application(UI-Core). I link and package the UI code and link it inside the host application i.e.
cd frontEnd/UI-Core
call npm i
call npm link .\src
and in host application:
cd UI-Host
call npm i
call npm link UI-Core
call npm run build:prod
package.json -> scripts has got the following entry:
"build:prod": "ng build --prod --aot --preserve-symlinks"
I am using a lazy loaded module in the UI which is running fine with ng build and throwing the error as shown in the attachment with --aot prod build.
I am not able to figure out what is wrong with my setup. Please find below the code i am using.
frontend/UI-Core:
----------------
ui-core.routing.ts
--------------------------
const routes: Routes = [
{
path: 'workflows',
canActivate: [AuthGuard],
loadChildren: './components/imported/admin/admin.module#AdminModule'
},
{ path: 'login', component: LogonPageComponent },
{ path: '', pathMatch: 'full', redirectTo: 'login' }
];
export const CoreRouting = RouterModule.forChild(routes);
index.ts
--------
#NgModule({
imports: [
CoreRouting
]
})
export class UICoreModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: UICoreModule,
providers: [
AuthService,
AuthGuard
]
};
}
}
Host application ( frontend/UI-Host)
----------------
app.module.ts
-------------
#NgModule({
imports: [
CUSTOM_IMPORTS
]
})
export class AppModule { }
custom\custom.app.ts
----------------------
import { UICoreModule } from 'ui-core';
export const CUSTOM_IMPORTS: any[] = [
UICoreModule.forRoot()
You may try for this:
Here we did aot false , which will not check all the depecies during production. use following.
ng build --prod --aot=false.

Meteor Up deployment error

I am deploying meteor app using Meteor Up.
The development app is at the location /apps/proto/meteor/GatewayUI
and i have the .deploy folder which is inside the GatewayUI folder.
On giving the command "mup deploy", I get the following error
{ Error: spawn meteor ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn meteor',
path: 'meteor', spawnargs:
[ 'build',
'--directory',
'/tmp/mup-meteor-981e8b09-055e-4ffe-a50a-d73d07c1ac5f',
'--architecture',
'os.linux.x86_64',
'--debug',
'--mobile-settings',
'/apps/proto/meteor/GatewayUI/settings.json' ] }
This error usually happens when meteor is not installed.
My mup.js is as follows:
module.exports = {
servers: {
one: {
// TODO: set host address, username, and authentication method
host: 'myhost',
username: 'myusername',
// pem: './path/to/pem'
password: 'mypassword'
// or neither for authenticate from ssh-agent
}
},
meteor: {
// TODO: change app name and path
name: 'GatewayUI',
path: '../../GatewayUI/',
servers: {
one: {},
},
buildOptions: {
debug: true,
executable: 'meteor',
},
env: {
// TODO: Change to your app's url
// If you are using ssl, it needs to start with https://
ROOT_URL: 'http://gatewayui.com',
MONGO_URL: 'mongodb://localhost/meteor',
},
// ssl: { // (optional)
// // Enables let's encrypt (optional)
// autogenerate: {
// email: 'email.address#domain.com',
// // comma seperated list of domains
// domains: 'website.com,www.website.com'
// }
// },
docker: {
// change to 'kadirahq/meteord' if your app is not using Meteor 1.4
image: 'abernix/meteord:base',
// imagePort: 80, // (default: 80, some images EXPOSE different ports)
},
// This is the maximum time in seconds it will wait
// for your app to start
// Add 30 seconds if the server has 512mb of ram
// And 30 more if you have binary npm dependencies.
deployCheckWaitTime: 60,
// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true
},
mongo: {
port: 27199,
version: '3.4.1',
servers: {
one: {}
}
}
};
A couple of things for this to not happen
1) make sure Meteor is installed. In my case, it was installed, however, the path was not set. It happened, because I forgot to add the path permanently
2) Docker, Mongo, Meteor should be installed in effect.
3) Every time, mup setup must precede mup deploy.

Resources