2016-11-17 32 views
0

我有一个小网站Node.js,我需要为手机做一些调整。 为此,我想访问HTTP_USER_AGENT。我怎样才能做到这一点?HTTP_USER_AGENT/Node.js

我已经在网上阅读了一些东西,但在这一点上没有找到可行的解决方案。 我经历的一件事是这https://www.npmjs.com/package/useragent

但只要我做起,加入这对我的代码:

var useragent = require('useragent'); 

在看网站时,我得到这个错误:

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. 

日志说:

Error: Cannot find module 'useragent' 

我显然不应该做正确的事情或做错事。

任何建议将不胜感激。

回答

2

您是否首先安装了软件包?

npm install --save useragent 

问候

+0

这确实是我失踪了。 – Michel