Happydevdays Happydevdays - 10 months ago 46
Linux Question

express on alpine linux - creating express application fails

I'm trying to create a node js application on alpine linux.
I just did an

apk add nodejs

And now I just tried this command:

myserver:/var/www/widgets# npm install express -g
express@4.14.0 /usr/lib/node_modules/express
├── escape-html@1.0.3
├── utils-merge@1.0.0
├── cookie-signature@1.0.6
├── merge-descriptors@1.0.1
├── methods@1.1.2
├── fresh@0.3.0
├── path-to-regexp@0.1.7
├── vary@1.1.0
├── encodeurl@1.0.1
├── range-parser@1.2.0
├── parseurl@1.3.1
├── array-flatten@1.1.1
├── etag@1.7.0
├── content-type@1.0.2
├── cookie@0.3.1
├── content-disposition@0.5.1
├── serve-static@1.11.1
├── depd@1.1.0
├── qs@6.2.0
├── on-finished@2.3.0 (ee-first@1.1.1)
├── finalhandler@0.5.0 (unpipe@1.0.0, statuses@1.3.0)
├── debug@2.2.0 (ms@0.7.1)
├── proxy-addr@1.1.2 (forwarded@0.1.0, ipaddr.js@1.1.1)
├── accepts@1.3.3 (negotiator@0.6.1, mime-types@2.1.12)
├── type-is@1.6.13 (media-typer@0.3.0, mime-types@2.1.12)
└── send@0.14.1 (destroy@1.0.4, ms@0.7.1, statuses@1.3.0, mime@1.3.4, http-errors@1.5.0)

But when i try to then create an express application, I'm getting an error.

myserver:/var/www/widgets# express testapp
-ash: express: not found

I'm not sure what I need to do next.

You You
Answer Source

The issue seems to be that you want to install the express-generator module:

$ npm install express-generator -g

Once you've done this, you can then use:

$ express myapp

To generate your new application, where myapp is the name of the application.

Source: Express application generator