This is my code:
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open("GET", "//URL")
xhr.setRequestHeader("Content-Type: application/json", "Authorization: Basic //AuthKey");
xhr.send();
I am getting the error:
Cannot find module 'xmlhttprequest'
When I remove the first line, I am getting:
XMLHttpRequest is not defined
I have searched all over and people have mentioned a problem with Node.js here and there but my installation of Node was correct so I'm not sure what the issue is.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…