I am learning about how to use API in Javascript. Then I got a mistake: “/opt/homebrew/bin/node ./app.js”
Uncaught Error Error: Cannot find module '/Users/cliu21/scratch/app.js'
at Module._resolveFilename (internal/modules/cjs/loader:1149:15)
at Module._load (internal/modules/cjs/loader:990:27)
at executeUserEntryPoint (internal/modules/run_main:142:12)
at <anonymous> (internal/main/run_main_module:28:49)
loader:1149
No debugger available, can not send 'variables'
This is my code:
// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
console.log("Starting Program");
client.messages
.list()
.then(messages => messages.array.forEach(m => console.log(m.sid)));
console.log("Gathering message log");
I have installed node_module and tried to fix the problem about 2hours, but canot fix it. enter image description here
How can I fix the problem?
New contributor
Claire liu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.