Tag: 节点

npm ERR! 无法读取null的属性“path”

** C:\ Users \ Abc> npm install -g npm ERR! addLocal无法安装C:\ Users \ Abc npm ERR! Windows_NT 6.1.7601 npm ERR! argv“C:\ Program Files \ nodejs \ node.exe”“C:\ Users \ Abc \ AppData \ Ro aming \ npm \ node_modules \ npm \ bin \ npm-cli.js”“install”“-g” npm ERR! 节点v7.2.1 npm ERR! npm v4.0.5 npm ERR! 无法读取null的属性“path” […]

在javascript str.replace中的特定索引之后replace一个string(from,to,indexfrom)

我喜欢在特定索引之后replacestring。 例如: var str = "abcedfabcdef" str.replace ("a","z",2) console.log(str) abcedfzbcdef 有没有什么办法在javascript或nodeJS做到这一点?

如何获取Aerospike Node.js客户端的主键

我试图从Aerospike获取所有logging和主键。 我尝试使用如下所示的client.queryfunction var query = client.query(aerospikeDBParams.dbName,"testRecords"); var stream = query.execute(); 与此我得到除主键以外的所有字段。如何获得主键与其他字段? 提前致谢

错误:指定的模块找不到

我试图使用edge.js来执行一些.NET代码,以在电子应用程序的窗口上打印。 我已经试过电子边缘 ,我也尝试手动build立edge.js模块针对Electron按照电子文档中的说明 ,但是当我尝试在封装的应用程序中使用边缘时,我不断收到以下错误: Error: The specified module could not be found. \\?\C:\path\to\app\app-1.0.0\resources\app.asar.unpacked\node_modules\edge\lib\native\win32\x64\6.5.0\edge_nativeclr.node at Error (native) at process.module.(anonymous function) (ELECTRON_ASAR.js:178:20) at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:178:20) at Object.Module._extensions..node (module.js:583:18) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:192:18) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) 我已经检查了文件系统,并且edge_nativeclr.node模块确实存在。 我的怀疑是,我不知道如何不正确地build立模块,它可能是针对错误版本的节点,所以电子无法导入模块。 我尝试了几个不同的东西,包括遵循electron-edge的手动更新build.bat 的步骤 ,并将–target=1.4.12 […]

为什么我不能在OSX 10.8.4上安装nodemon或supervisor?

我只是想使用terminal来安装nodemon或supervisor,而且我一直得到这个我不明白的错误。 我试着以sudo npm install supervisor -g的pipe理员身份运行,似乎可以正常工作,但是当我删除/添加了一些js代码的时候没有。 有任何想法吗? Squirrels-MacBook-Air:lesson7_examples Squirrel$ npm install nodemon -g npm http GET https://registry.npmjs.org/nodemon npm http 304 https://registry.npmjs.org/nodemon npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/nodemon' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/nodemon'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/nodemon', npm ERR! fstream_type: 'Directory', npm ERR! fstream_path: '/usr/local/lib/node_modules/nodemon', npm […]

NodeMailerlogin无效

我是node.js编程的新手。我使用nodemailer模块来发送邮件。 const nodemailer = require ('nodemailer'), credentials=require('./credentials.js'); var mailTransport=nodemailer.createTransport({ service:'Gmail', auth: { user : credentials.gmail.user, pass : credentials.gmail.password, } }); function sendMail(mail_id){ mailTransport.sendMail({ from: ' "my name" <myname@gmail.com>', to : mail_id, //user@gmail.com subject : 'Hello', text: "Hello How do u do ?", },function(err,info){ if(err){ console.log('Unable to send the mail :'+err.message); } else{ console.log('Message response : […]

从Aerospike node.js客户端检索主键

我正在尝试使用client.get()来检索Aerospike node.js客户端中的主键。 我已经使用client.put()通过将策略更改为Aerospike.policy.key.SEND来插入logging,如此处和此处所述 。 现在我想和主键一起检索logging。 我试过像Aerospike文档中提到的那样做,但似乎并不奏效。 var key = aerospike.key(aerospikeDBParams.defaultNamespace,aerospikeDBParams.defaultSet,count); var readpolicy = { key: aerospike.policy.key.SEND } client.get(key, readpolicy, function(err, rec, meta){} 我得到所有的垃圾箱,但不是主键。 我在这里错过了什么? 提前致谢。

防止垃圾邮件 使用Nodemailer; 使用Sendmail

我正在使用Nodemailer Node.js模块来连接sendmail。 但是,我的电子邮件直接通过Gmail帐户进入垃圾邮件文件夹。 为什么我的电子邮件是垃圾jar头? 它一定是与电子邮件的标题有关,但我不知道它可能是什么。 我对电子邮件和垃圾邮件filter不太了解,所以有人请给我提供一些关于要注意什么的细节。 谢谢阅读。 🙂

NPM模块安装错误

我得到错误:隧道套接字无法build立,导致= getaddrinfo ENOTFOUND而试图在node.js中安装模块。 这似乎有一些代理错误。我检查了浏览器设置,代理被禁用。 但是,当我在命令提示符检查npmconfiguration获取代理,得到192.168.98.5:8080。 如何禁用这个?

Nodejs,表示路由为es6类

我想清理我的项目,现在我尝试使用es6类为我的路线。 我的问题是这总是未定义的。 var express = require('express'); var app = express(); class Routes { constructor(){ this.foo = 10 } Root(req, res, next){ res.json({foo: this.foo}); // TypeError: Cannot read property 'foo' of undefined } } var routes = new Routes(); app.get('/', routes.Root); app.listen(8080);