[英]How to properly link to nodejs curve25519 library
I have cloned git repository https://github.com/thejh/node-curve25519 and next used npm link
inside it. 我已经克隆了git仓库https://github.com/thejh/node-curve25519 ,然后在其中使用了
npm link
。 I am using this library in suggested way: var curve = require('curve25519');
我以建议的方式使用此库:
var curve = require('curve25519');
. 。 But I am getting this error on the line
curve.makeSecretKey()
in this fragment: 但是我在这个片段的曲线
curve.makeSecretKey()
中得到了这个错误:
temp.secret = crypto.randomBytes(32);
curve.makeSecretKey(temp.secret);
This is error message: 这是错误消息:
/Users/username/Workspaces/nodejs/myproject/server.js:59
curve.makeSecretKey(ctx.private);
^
TypeError: Object #<Object> has no method 'makeSecretKey'
at handlers.(anonymous function) (/Users/username/Workspaces/nodejs/myprojet/server.js:59:8)
at Socket.<anonymous> (/Users/username/Workspaces/nodejs/myproject/server.js:198:3)
at Socket.EventEmitter.emit (events.js:98:17)
at UDP.onMessage (dgram.js:440:8)
What am I doing wrong? 我究竟做错了什么? This library should contains such method.
该库应包含此类方法。 As you can see: https://github.com/thejh/node-curve25519/blob/master/index.js
如您所见: https : //github.com/thejh/node-curve25519/blob/master/index.js
You need to also link the library from your project directory. 您还需要从项目目录链接库。
An example from the docs : 来自docs的示例:
cd ~/projects/node-redis # go into the package directory
npm link # creates global link
cd ~/projects/node-bloggy # go into some other package directory.
npm link redis # link-install the package
In your case, the first package directory is the curve25519
git repo and if I understood your question correctly, the line you need to run in your project directory is npm link curve25519
在您的情况下,第一个程序包目录是
curve25519
git repo,如果我正确理解了您的问题,则需要在项目目录中运行的行是npm link curve25519
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.