草庐IT

optional_argument

全部标签

node.js - 错误 : options. uri 是必需的参数

我正在使用node.jsv4.6.0和最新版本的express、request和body-parser,但我得到一个我无法修复的错误代码,有什么想法吗?这是我的代码:varexpress=require('express');varrequest=require('request');varbodyparser=require('body-parser');varapp=express();app.use(bodyparser.urlencoded({extended:true}))varwebhook=process.env.DISCORD_WEBHOOK;app.get('/',(

node.js - Bcrypt 错误 : illegal arguments String unidentified

这是我的完整代码varexpress=require('express'),app=express(),mongoose=require('mongoose'),bodyParser=require('body-parser'),morgan=require('morgan'),webToken=require('jsonwebtoken'),bcrypt=require('bcryptjs'),assert=require('assert');Schema=mongoose.Schema,secretKey="omjdiuwkslxmshsoepdukslsj";//UserSche

node.js - 错误 : Argument "data" is not a valid Document. 输入不是纯 JavaScript 对象

我收到了错误Error:Argument"data"isnotavalidDocument.InputisnotaplainJavaScriptobject.更新文档时,使用firebaseadminSDK。这里是Typescript代码。varmyDoc=newMyDoc();myDoc.Public.Name="JonhDoe"//setupupcontentadmin.firestore().collection('MyDocs').doc("Id1").set(myDoc); 最佳答案 我做了类似的事情:varmyDoc={

javascript - AngularJS/Jade 错误 : Argument 'MyController' is not a function, 未定义(平均值)

我知道这个问题的变体已经被问过好几次了,但我已经为其他OP尝试了几个建议的解决方案,但无法解决这个问题,希望能得到一些澄清。我正在使用基本的平均待办事项列表应用程序(http://www.mean.io/)。在实现了一个简单的Controller后,我遇到了“错误:参数'nameOfMyController'不是函数,未定义。”这是我所在的位置:app.js(样板文件)window.app=angular.module('mean',['ngCookies','ngResource','ui.bootstrap','ui.route','mean.system','mean.artic

node.js - 奇怪的 Mongoose schema.js 错误 - `options` 不能用作模式路径名

在我的架构中,如果我有options在metrics:[{options:{}}]那么我得到:/home/one/cloudimageshare-monitoring/project/node_modules/mongoose/lib/schema.js:282thrownewError("`"+path+"`maynotbeusedasaschemapathname");^Error:`options`maynotbeusedasaschemapathname但是,如果将options更改为任何其他单词...例如qoptions...。那么错误就会消失。为什么会这样?varmongo

javascript - 为什么 Javascript 函数 `arguments` 不是 node.js 中 Array 的实例?

最近看了很多NodeJS和Javascript代码,似乎arguments不是Array的一个实例,但仍然表现得像一个,所以人们做了类似Array.prototype.slice.call(arguments,...)或[].slice.call(arguments)增加了冗长并增加了新手理解的障碍等。参数不是Array的实例或者这只是那些坏的部分之一? 最佳答案 否。arguments是一个独立的对象,恰好有一个length属性并且能够使用[]来索引它。但除此之外,它只是一个对象,而不是Array对象。是的,这确实是JavaScr

node.js - 类型错误 : The "digest" argument is required and must not be undefined

我在通过http://localhost:3000/auth/register注册一个简单的平均应用程序时遇到主题错误,我只是使用meaninit命令创建的。pbkdf2或crypto正在生成错误,我不知道在哪里寻找它。我做了很多不同的事情,比如清除npm缓存,使用npm重新安装等。请帮帮我。以下是更多信息。Mean--version:0.12.15npm--version:5.0.3node--version:v8.1.0bower--version:1.8.0gulp--version:CLIandLocal:3.9.1model.UserSchema.methods.hashPa

node.js - Bower - 安装包 "Arguments to path.join must be strings"时出错

我刚刚创建了一个Node项目,正在尝试使用bower安装jquery。bowerinstalljquery我收到以下错误:bowerjquery#*not-cachedgit://github.com/jquery/jquery.git#*bowerjquery#*resolvegit://github.com/jquery/jquery.git#*bowerjquery#*errorArgumentstopath.joinmustbestringsStacktrace:TypeError:Argumentstopath.joinmustbestringsatf(path.js:204

node.js - 参数错误,node.js 中的 options.body?

我不知道是什么问题,请帮助解决这个问题。当我发布数据时,终端上会显示以下错误。附上代码也是。Error:Argumenterror,options.body.atRequest.init(/usr/lib/nodejs/request/index.js:351:13)atnewRequest(/usr/lib/nodejs/request/index.js:124:8)atObject.request(/usr/lib/nodejs/request/index.js:1279:11)atRequest._callback(/var/www/html/nodeproject/hellow

javascript - SyntaxError : missing ) after argument list, 使用异步时

为什么我在使用async时会收到此错误?我的代码:bot.onText(/\/start/,asyncmsg=>{constopts={parse_mode:'Markdown',reply_markup:JSON.stringify({keyboard:StartKeyboard,resize_keyboard:true,one_time_keyboard:true})};awaitbot.sendMessage(msg.chat.id,'Hi',opts);});错误:bot.onText(/\/start/,asyncmsg=>{^^^^^SyntaxError:missing)