Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript “如何修复”;运行此应用程序的环境不支持此操作&引用;位置。协议“&引用;错误?_Javascript_Firebase_Firebase Authentication - Fatal编程技术网

Javascript “如何修复”;运行此应用程序的环境不支持此操作&引用;位置。协议“&引用;错误?

Javascript “如何修复”;运行此应用程序的环境不支持此操作&引用;位置。协议“&引用;错误?,javascript,firebase,firebase-authentication,Javascript,Firebase,Firebase Authentication,我尝试使用Firebase(Google)身份验证,但出现以下错误: 运行此应用程序的环境不支持此操作。“location.protocol”必须是http、https或chrome扩展,并且必须启用web存储 我的代码是: var provider = new firebase.auth.GoogleAuthProvider(); function Singin(){ firebase.auth().signInWithPopup(provider).then(function(re

我尝试使用Firebase(Google)身份验证,但出现以下错误:

运行此应用程序的环境不支持此操作。“location.protocol”必须是http、https或chrome扩展,并且必须启用web存储

我的代码是:

var provider = new firebase.auth.GoogleAuthProvider();  

function Singin(){
  firebase.auth().signInWithPopup(provider).then(function(result) {
    var user = result.user;
    console.log(user);
  }).catch(function(error) {
    console.log(error);
    console.log(error.message)
  });
}
完全错误是:

zi {code: "auth/operation-not-supported-in-this-environment", message: "This operation is not supported in the environment…chrome-extension and web storage must be enabled."}
code: "auth/operation-not-supported-in-this-environment"
message: "This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled."
__proto__: Error

不能使用NodeJS运行客户端JS,其中
location.protocol
可能是
typeof“undefined”
。您对环境使用了错误的一个客户端库;尝试JavaScript和JavaScript不一定是一回事……

我也遇到了这个错误。
我通过在线托管我的项目来修复它

,因此您正在从文件加载://?那就可以解释了。是的,我知道。这就是问题所在吗?是的。正如上面所说的。我如何修复它?从服务器上运行这听起来不太对。在那之前一切都很好。我更新了NPM。恕我直言,试试另一个不是好答案。我不知道正确的答案是什么,但事实并非如此。国际海事组织。