Issue
I received this project to deploy, which uses the hapi npm that I am not familiar with. I am able to run it successfully localy but when I try to deploy it I get an error, on heroku
the error is:
npm ERR! missing script: start
I think maybe I have to change something in the index.js maybe the port or the host inside server const?
Here is my index.js
const Hapi = require('hapi');
const path = require('path');
const fs = require('fs');
const util = require('util');
const readDir = util.promisify(fs.readdir);
const server = Hapi.server({
port: 3000,
host: 'localhost',
routes: {
files: {
relativeTo: path.join(__dirname, 'public')
}
}
})
const start = async () => {
await server.register(require('vision'));
await server.register(require('inert'));
server.views({
engines: {
html: require('handlebars')
},
relativeTo: __dirname,
path: 'templates',
layout: 'layout-other',
layoutPath: 'templates/layout'
});
// Static files
server.route({
method: 'GET',
path: '/{param*}',
handler: {
directory: {
path: path.join(__dirname, 'public'),
listing: true
}
}
});
require('./routes')(server);
server.start();
}
start();
Thanks
Solution
missing script: start
. In your package.json,
means you are missing to configure
where to start
check your package.json
file you should define that like this
"scripts": {
"start": "node index.js"
}
If your app has a build step that you’d like to run when you deploy, you can use a Postinstall script in package.json:
Answered By - ArunPratap Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.