在当前版本的Node.js中是否有对promises的原生支持?
Node.js使用V8引擎。这个JavaScript引擎也被Chrome使用,Chrome32对promises有本机支持。但我似乎不能(在本地)得到在Node.js中工作的承诺。
我已经在Chrome32中尝试了下面的代码,它可以工作。
var promise = new Promise(function(resolve, reject) {
// do a thing, possibly async, then…
if ( 1===1 /* everything turned out fine */) {
我正在关注youtube上的NodeJs教程,但是当涉及到通过id删除用户时,它的工作方式并不像教程中的那样。但在这段视频里,一切似乎都是完美的。这是我的密码。我哪里错了?期待大家的评论。
let deleteUserByID = (userId)=>{
return new Promise(async(resolve, reject)=>{
try{
let user = await db.User.findOne({
where: {id: userId}
})
我将按照本教程来设置mongo atlas db。
但是在设置连接时,我得到了如下错误
(node:60566) UnhandledPromiseRejectionWarning: MongoError: user is not allowed to do action [find] on [admin.sample_airbnb]
at queryCallback (/Users/jay.lin/dev/graphql-playlist/server/node_modules/mongodb-core/lib/cursor.js:223:25)
at /Users/jay.
我两个小时前开始学习Angular JS,在教程中看到了这一点:
var app = angular.module("githubViewer", []);
var MainController = function($scope, $http){
var onUserComplete = function(response){
$scope.user = response.data;
};
var onError = function(reason){
$scope.error = "Failed to ge
我使用的是node版本的v9.10.0,并且遵循教程。由于ask init,我能够初始化配置文件(这是第一次,不是为了进一步使用它),此后(当我试图覆盖我的配置文件时),我得到了这个错误:
? Please create a new profile or overwrite the existing profile.
[Nikhil Sanjay Wagh] "default"
(node:3316) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of n
我正在跟随来自达普大学的区块链教程。
当我在行中创建任务时
await App.todoList.createTask(content)
从线
我得到以下错误:
Uncaught (in promise) Error: The send transactions "from" field must be defined!
at Method.inputTransactionFormatter (truffle-contract.js:50747)
at truffle-contract.js:51228
at Array.map (<anonymo
我一直在学习如何创建第一个具有坚实性和响应性的Web3js应用程序的教程。
在我陷入元problem的这个问题之前,本教程一直进展顺利。
我一直在学习的教程是:
现在,在尝试从ethereum运行函数时,我得到了以下错误
inpage.js:1 MetaMask - RPC Error: The method "accounts " does not exist / is not available.
inpage.js:1 MetaMask - RPC Error: The method "eth_accounts " does not exist / is
我在上学习阿波罗教程。我的服务器在localhost:4000上运行成功,我的客户机在localhost:3000上运行。客户端编译成功,但我在浏览器中得到一个400错误,并且它指向一个Apollo错误:
Uncaught (in promise) Error: Network error: Response not successful: Received status code 400 at new ApolloError (bundle.esm.js:76)。
本教程使用TypeScript作为客户端,但我没有安装它,所以我全局安装了它,但除了教程提到的之外,我没有对客户端进行任何其他更
当我尝试创建一个角度路由链接时,我一直收到这个错误:
zone.js:461 Unhandled Promise rejection: Template parse errors:
Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
</h1>
<button (click)="doLogin()">Login</button>
<a [ERROR ->][routerLink]="
我试着在node.js上使用谷歌的对话流程库,我遵循了这个教程,但是得到了这个错误:
(node:25452) UnhandledPromiseRejectionWarning: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.<anonymous> (D:\WORK\chatbot-app-master\node_m
我正在尝试修改教程中用vuejs、nodejs、express和mysql编写的应用程序。但是,我的节点应用程序容器遇到db连接问题,如下所示:
服务器正在8080端口上运行。未处理的拒绝:连接经济实体127.0.0.1:3306在/app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:123:19 at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/a
我正在学习Wes Bos的教程“学习Node.js”。
我下载了所有的入门文件,并用MongoDb地图集创建了一个数据库。
当我运行npm start时,我得到这个错误:
UnhandledPromiseRejectionWarning: Error: URI does not have hostname, domain name and tld
DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will
有关同一教程的类似问题已经在这里被问到了。遗憾的是,这是本教程的一个更高级的部分,我似乎不明白这一点。
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'params')
at fetchProduct (ProductScreen.js:16:1)
at ProductScreen.js:19:1
at commitHookEffectListMount (react-dom.development.js:23150:1)
at comm
我正在尝试创建一个Node脚本,该脚本将连接到外部服务器的MongoDB并插入一个用户。我在几十个使用localhost的教程中找到了一些基本的东西。出现的问题是,当遵循这些教程时,无论我尝试了什么,我似乎都得到了一个TypeError:未定义不是一个函数消息。我知道这是因为我对Mongo和Node都是新手,但不幸的是,知道这一点并不会让我更容易理解。
我的代码没有涉及到任何网页,在这种情况下,它只是一个后端连接。代码如下:
var User = require('/var/www/html/testing/folder1/User.js');
var mong