How come nothing happens when I run an npm module?

So when I use npm install to download a package onto my raspberry pi nothing happens when i run the scripts in the new folder created in /node_modules. For example, I use the command ‘node file.js’ and then nothing happens. I would assume that a bunch of information would appear on the terminal while using an ongoing application but nothing happens and it goes right back to awaiting another command. Sometimes when I use other packages apparently there are coding errors too so I’m not sure about that either.

Hi @raoulalien!

There are two main sorts of packages.

The first type implements a “command” to run. These are sometimes installed globally so they can be used outside a project. e.g.

npm install -g n
n --help

The second type of package has code which you can use from your javascript program:

npm install fs-extra
const fsX = require('fs-extra');
fsX.copySync('source', 'destination');

Check the documentation for the package you are trying to use, or run through a tutorial. You do not normally run a file out of node_modules directly yourself.

So when I use npm install to download a package onto my raspberry pi nothing happens when i run the scripts in the new folder created in /node_modules. For example, I use the command ‘node file.js’ and then nothing happens. I would assume that a bunch of information would appear on the terminal while using an ongoing application but nothing happens and it goes right back to awaiting another command. Sometimes when I use other packages apparently there are coding errors too so I’m not sure about that either. whatsapp web192.168.0.1

my issue got solved!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.