Michel Michel - 1 year ago 151
Javascript Question


I have a little web site working with

, and I need to do some tuning for mobiles.
For this I would like to access the
. How can I do that?

I have read a few things on the net, but didn't come to a working solution at this point.
One of the thing I went through is this https://www.npmjs.com/package/useragent.

But as soon as I start, adding this to my code:

var useragent = require('useragent');

I get this error when looking at the site:

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.

The log says:

Error: Cannot find module 'useragent'

I must obviously not be doing the right thing or doing it wrong.

Any suggestion will be much appreciated.

Answer Source

Did you installed your package first ?

npm install --save useragent


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download