gpt4 book ai didi

javascript - HTTP_USER_AGENT/Node.js

转载 作者:行者123 更新时间:2023-12-02 13:56:44 25 4
gpt4 key购买 nike

我有一个使用 Node.js 的小网站,我需要对移动设备进行一些调整。为此,我想访问HTTP_USER_AGENT。我怎样才能做到这一点?

我在网上阅读了一些内容,但目前还没有找到可行的解决方案。我经历过的一件事是这个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'

我显然没有做正确的事或做错了事。

任何建议将不胜感激。

最佳答案

您是否先安装了软件包?

npm install --save useragent

问候

关于javascript - HTTP_USER_AGENT/Node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40645103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com