I am having a npm package which serves as a local host. What I want is after user use npm install -g
to install it, they can use the command easydx
to run the local host and web pages can be served as in a static server.
During development, it works fine with npm start
and the pages can successfully open at localhost:3666. But when I publish the package and tested it using npm install -g
to install it. After easydx
successfully fires the server, localhost:3666 get the cannot get / error.
My package contains the line:
"bin": {
"easydx": "index.js"
},
and my index.js file begins with
#! /usr/bin/env node
So what is going wrong here?
In my index.js file:
I have used:
app.use(express.static('dist'));
to serve the static web files. And have used express routes for the web service.