express on alpine linux - creating express application fails - node.js

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
myserver:/var/www/widgets#
I'm not sure what I need to do next.
Thanks.

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

Related

How to avoid Asterius `ahc-link` polluting the source directory?

I'm using ahc-link --output-directory _build, which produces a bunch of build artifacts in the _build directory as expected:
_build/
├── default.mjs
├── main.mjs
├── main.req.mjs
├── main.wasm
├── main.wasm.mjs
├── rts.autoapply.mjs
├── rts.closuretypes.mjs
├── rts.constants.mjs
├── rts.eventlog.mjs
├── rts.exception.mjs
├── rts.exports.mjs
├── rts.float.mjs
├── rts.fs.mjs
├── rts.funtypes.mjs
├── rts.gc.mjs
├── rts.heapalloc.mjs
├── rts.integer.mjs
├── rts.jsval.mjs
├── rts.memory.mjs
├── rts.memorytrap.mjs
├── rts.messages.mjs
├── rts.mjs
├── rts.modulify.mjs
├── rts.reentrancy.mjs
├── rts.scheduler.mjs
├── rts.setimmediate.mjs
├── rts.stablename.mjs
├── rts.stableptr.mjs
├── rts.staticptr.mjs
├── rts.symtable.mjs
├── rts.time.mjs
├── rts.tracing.mjs
├── rts.unicode.mjs
└── rts.wasi.mjs
However, it also pollutes the source directory with the following intermediate build artifacts:
?? src/Hardware/MOS6502/Emu.hi
?? src/Hardware/MOS6502/Emu.o
?? src/main.hi
?? src/main.o
Is there some other flag I need to pass to ahc-link to put these files under _build as well?

node.js and express -bash: /usr/bin/express: No such file or directory

I started a Digital Ocean droplet from the node.js image ( w ubuntu 14.04)
checking it, I get :
$ node -v
v4.3.0
Then , I tried to install the latest version of express.js :
$ sudo npm install -g express
express#4.13.4 /usr/lib/node_modules/express
├── escape-html#1.0.3
├── array-flatten#1.1.1
├── cookie-signature#1.0.6
├── utils-merge#1.0.0
├── content-type#1.0.1
├── merge-descriptors#1.0.1
├── vary#1.0.1
├── methods#1.1.2
├── fresh#0.3.0
├── etag#1.7.0
├── parseurl#1.3.1
├── path-to-regexp#0.1.7
├── cookie#0.1.5
├── content-disposition#0.5.1
├── range-parser#1.0.3
├── serve-static#1.10.2
├── depd#1.1.0
├── qs#4.0.0
├── on-finished#2.3.0 (ee-first#1.1.1)
├── finalhandler#0.4.1 (unpipe#1.0.0)
├── debug#2.2.0 (ms#0.7.1)
├── proxy-addr#1.0.10 (forwarded#0.1.0, ipaddr.js#1.0.5)
├── send#0.13.1 (destroy#1.0.4, statuses#1.2.1, ms#0.7.1, mime#1.3.4, http-errors#1.3.1)
├── type-is#1.6.11 (media-typer#0.3.0, mime-types#2.1.10)
└── accepts#1.2.13 (negotiator#0.5.3, mime-types#2.1.10)
but when I check express version , I get an error :
$ express -v
-bash: /usr/bin/express: No such file or directory
what could be wrong ? thanks for feedback
UPDATE ---
I uninstalled& reinstalled node.js :
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodes
$ node -v
v4.3.1
but same issue
sudo npm install -g express
express#4.13.4 /usr/lib/node_modules/express
...
$ express -v
-bash: /usr/bin/express: No such file or directory
Check that /usr/lib/node_modules/express is present in your PATH variable.
echo $PATH will print current PATH
Also, maybe you dint install express-generator?

Nodejs on Windows, npm doesn't install modules from registry

I'm having a problem with my new installation of Node.js (windows 64 bit).
I'm trying to install the express module inside a project of mine but I can't work it out.
I type this command :
npm install -g express
However this is the result of the command
├── escape-html#1.0.1 ├── merge-descriptors#0.0.2 ├── cookie-signature#1.0.5 ├── utils-merge#1.0.0 ├── cookie#0.1.2 ├── range-parser#1.0.2 ├── finalhandler#0.3.2 ├── fresh#0.2.4 ├── media-typer#0.3.0 ├── methods#1.1.0 ├── vary#1.0.0 ├── parseurl#1.3.0 ├── serve-static#1.7.1 ├── content-disposition#0.5.0 ├── path-to-regexp#0.1.3 ├── depd#1.0.0 ├── qs#2.3.3 ├── on-finished#2.1.1 (ee-first#1.1.0) ├── debug#2.1.0 (ms#0.6.2) ├── etag#1.5.1 (crc#3.2.1) ├── send#0.10.1 (destroy#1.0.3, ms#0.6.2, mime#1.2.11) ├── proxy-addr#1.0.4 (forwarded#0.1.0, ipaddr.js#0.1.5) ├── accepts#1.1.4 (negotiator#0.4.9, mime-types#2.0.4) └── type-is#1.5.4 (mime-types#2.0.4)
It's the list of dependecies needed by express but there's no download of them.
The first time I tried to use npm I had this problem (https://github.com/npm/npm/issues/4808)
There were many solutions to solve it, one of them consist in disable the layer ssl for the connection to the npm online registry but I don't think there's a connection between this solution (that I applied) and the problem.
Thank you in advance,
Luca
The express module should be installed on a per project basis.
npm install --save express

node.js ( how to create express)

lee-ui-MacBook-Pro:test1 ErinLee$ sudo npm install -g express
Password:
express#4.9.5 /usr/local/lib/node_modules/express
├── merge-descriptors#0.0.2
├── utils-merge#1.0.0
├── fresh#0.2.4
├── cookie#0.1.2
├── escape-html#1.0.1
├── range-parser#1.0.2
├── cookie-signature#1.0.5
├── finalhandler#0.2.0
├── vary#1.0.0
├── media-typer#0.3.0
├── parseurl#1.3.0
├── methods#1.1.0
├── serve-static#1.6.3
├── path-to-regexp#0.1.3
├── depd#0.4.5
├── qs#2.2.4
├── on-finished#2.1.0 (ee-first#1.0.5)
├── etag#1.4.0 (crc#3.0.0)
├── proxy-addr#1.0.3 (forwarded#0.1.0, ipaddr.js#0.1.3)
├── accepts#1.1.1 (negotiator#0.4.8, mime-types#2.0.2)
├── send#0.9.3 (destroy#1.0.3, ms#0.6.2, mime#1.2.11)
├── type-is#1.5.2 (mime-types#2.0.2)
└── debug#2.0.0 (ms#0.6.2)
lee-ui-MacBook-Pro:test1 ErinLee$ express
-bash: express: command not found
lee-ui-MacBook-Pro:test1 ErinLee$ express test1
-bash: express: command not found
lee-ui-MacBook-Pro:test1 ErinLee$
what's wrong?? why i can't create express??
i'm in terminal on mac os X
express is a node.js module.
You are looking for the express generator:
npm install -g express-generator
https://github.com/expressjs/generator

Express JS command is not working

After installing Express with Node.js using this command:
npm install -g express
I am not able to use the express command, I get thrown the error in windows that express is not an internal or external command.
I've checked to make sure Express was installed by using the command npm -g ls and express shows up in there like this:
C:\wamp\www\blackbook>npm -g ls
C:\Users\Chris\AppData\Roaming\npm
└─┬ express#4.0.0
├─┬ accepts#1.0.0
│ ├── mime#1.2.11
│ └── negotiator#0.3.0
├── buffer-crc32#0.2.1
├── cookie#0.1.0
├── cookie-signature#1.0.3
├── debug#0.8.0
├── escape-html#1.0.1
├── fresh#0.2.2
├── merge-descriptors#0.0.2
├── methods#0.1.0
├── parseurl#1.0.1
├── path-to-regexp#0.1.2
├── qs#0.6.6
├── range-parser#1.0.0
├─┬ send#0.2.0
│ └── mime#1.2.11
├─┬ serve-static#1.0.1
│ └─┬ send#0.1.4
│ ├── fresh#0.2.0
│ ├── mime#1.2.11
│ └── range-parser#0.0.4
├─┬ type-is#1.0.0
│ └── mime#1.2.11
└── utils-merge#1.0.0
Any ideas as to what I'm doing wrong or what I can do to fix it so I can use express?
I see you installed the latest Express.js version 4.0.0. In this version they removed the application generation from express itself. This is now a separated module called express-generator.
To install it, use the following command
$ npm install -g express-generator
To read more, check out the Express.js docs #executable

Resources