简体   繁体   English

导入节点模块会产生错误

[英]importing a node module create an error

I imported node module 'request' in app.js but as soon as my script read, 我在app.js中导入了节点模块'request',但是一旦我的脚本读了,

var request = require('request'); 

it creates an error like below. 它会产生如下错误。 Anyone has an idea? 有人有想法吗?

Error Message: 错误信息:

[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random() [SECURITY] node-uuid:crypto不可用,回退到不安全的Math.random()

request depends on the library node-uuid . 请求取决于库node-uuid 'node-uuid' is used for generating random UUID's , also called GUID's. 'node-uuid'用于生成随机UUID ,也称为GUID。

To get truly random UUID's, node-uuid requires a cryptographically secure random source. 要获得真正随机的UUID,node-uuid需要一个加密安全的随机源。 Normally it will use crypto.randomBytes (in node) or crypto.getRandomValues (in the browser), but if that does not exist it will fall back to Math.Random. 通常它会使用crypto.randomBytes (在节点中)或crypto.getRandomValues (在浏览器中),但如果不存在,它将回退到Math.Random。 However, Math.random cannot generate cryptographically secure random numbers ( read here for more info ). 但是,Math.random 无法生成加密安全随机数请在此处阅读以获取更多信息 )。

Request uses UUID's for its OAuth nonces and multipart file uploads. 请求使用UUID进行OAuth nonce和multipart文件上传。 If you use OAuth, not having secure random nonces may be a security concern. 如果您使用OAuth,则没有安全的随机nonce可能是一个安全问题。

The crypto module should be present in all node installations (to my knowledge), so it's likely that you are running this code in a web browser environment. 加密模块存在于所有节点安装中(据我所知),因此您可能正在Web浏览器环境中运行此代码。 You may be running in a web browser that doesn't support the crypto module quite yet, and therefore Math.random is really your only option. 您可能正在运行不支持加密模块的Web浏览器,因此Math.random是您唯一的选择。 You can check the can i use page to see if your browser supports getRandomValues . 您可以查看我可以使用页面查看您的浏览器是否支持getRandomValues

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM