Andrés Marotta
Andrés Marotta

Reputation: 345

NodeJS cannot find Express module on Raspberry

I'm testing a simple NodeJS app in my Raspberry but I can't get it working. I developed and tested in my Windows 10 and it works great, but when I move the files into the Raspberry it says node can't find express module:

EDIT: I've re-upload the image since I mistaken the previous

node app.js

Data:

  • Raspberry Pi Model: 3B V1.2
  • OS: Raspbian GNU/Linux 9 (stretch)
  • NodeJS: v8.11.3
  • NPM: 5.6.0

I've read another questions and try the next steps (without success):

  • npm install
  • sudo npm install
  • npm install express
  • sudo npm install express
  • npm install express --save

In my node_modules folder it seems to be everything ok:

node_modules folder

My folders structure:

enter image description here

Upvotes: 0

Views: 984

Answers (2)

Natsathorn
Natsathorn

Reputation: 1528

It is typo. You are trying to use Express not express

NodeJS are case sensitive, so you have to make sure that your character are in the same case.

Upvotes: 2

gomes
gomes

Reputation: 731

It cannot find app.js... Because there is none in this folder ;)

You're trying to launch your app.js while cdd in your node_modules folder. The way node modules work is that they'll be installed in a node_modules folder that you can then access app-wise by either requireing them (CommonJS) or importing them (ESModules). Here, it seems like you're just in the wrong cd, simple as that.

Upvotes: 0

Related Questions