0
我已将twilio节点模块下载到我的项目所在的本地目录中。但是当我运行节点文件时,它会引发错误。在这里的错误下面,我已经概述了目录。节点无法找到本地目录中的模块
错误:
gamacbook:twilioapp gattra$ node app.js
module.js:340
throw err;
^
Error: Cannot find module 'node_modules/twilio/lib'
我的本地目录是:
twilioApp
|_app.js
|_index.html
|_main.css
|_script.js
|_node_modules
|_twilio
|_lib
明明有一堆twilio
目录中的文件,但我试图访问那些lib
。
我的代码是:
var accountSid = "removed";
var authToken = "removed";
var client = require('node_modules/twilio/lib')(accountSid, authToken);
app.get('/', function() {
client.messages.create({
body: "Today is awesome and you rock!",
to: phoneNumber,
from: "removed"
}, function (err, message) {
process.stdout.write(message.sid);
})
})