Tag: 本地

Node.js:全局声明node_modules,或根据需要在本地声明?

Node_modules依赖关系应该在应用程序代码的开始处全局声明,还是在需要时在本地声明? 我想知道是否有最佳做法。 例如,我使用index.js引导我的应用程序,并在需要时需要脚本。 例如,我的security.js模块可能需要使用node_hash 。 现在,我应该要求在security.js中 var node_hash = require('node_hash') 或全局要求在index.js所以它是可用的security.js (但也是一切)?

在windows上安装node-gd

在过去的几个小时里,我试图在windows上运行node-gd 。 我已经尝试了几次回购,最后find了https://github.com/mikesmullin/node-gd 。 当我跑步 `npm install node-gd` 我收到以下错误: node-gyp rebuild …node_modules\node-gd>node "C:\Program Files\nodejs\node_modules\npm\ bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. node-gd.cpp ..\cpp\node-gd.cpp(17): fatal error C1083: Cannot open include file: 'gd.h': No such file or directory […\node_modules\node-gd\build\node_gd.vcxproj ] 我以为我应该安装gd lib,但是当我使用它时,几乎所有的信息都是关于php_gd而不是lib本身。 我应该在哪里放gd文件? […]

使用JXCore构build本机64位和32位exe文件

我正在寻找一种方法来在我的64位开发机器上build立一个本地的32位exe文件。 通常我会运行:jx编译。\ PhotoFly.jxp但是,这产生了一个64位版本。 任何想法如何获得32位版本?

本地NPM模块(npm链接)部署到Heroku

我正在使用npm链接添加我的本地模块到我的应用程序。 它在我的本地机器上工作得很好,但是当我运行grunt并把它推到Heroku时,它说我的模块没有find! 我有一个单一的回购一切。 我应该为NPM私人存储库支付每月$ 7吗? 那是我最后的手段 任何想法如何得到这个工作? PS发布我的私有模块到公共NPM不是一个选项,它是一个数据库模式模块在多个应用程序中使用。 我不想在任何地方复制和粘贴我的数据库模式 由于Git的文件名大小限制,手动将本地模块复制到node_modules中也不是一个选项: fatal: unable to stat : Filename too long Use –force to continue.

如何告诉一个本地的node.js扩展名在哪里可以find(正确的)libstdc ++?

我正在从npm安装scrypt ( https://www.npmjs.com/package/scrypt )。 安装涉及构build本地node.js扩展的node-gyp构build步骤。 当我然后启动我的应用程序,它失败,出现以下错误: node index.js module.js:568 return process.dlopen(module, path._makeLong(filename)); ^ Error: /package/host/localhost/gcc-4/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/xxxx/xxxx/node_modules/scrypt/build/Release/scrypt.node) at Error (native) at Object.Module._extensions..node (module.js:568:18) at Module.load (module.js:456:32) at tryModuleLoad (module.js:415:12) at Function.Module._load (module.js:407:3) at Module.require (module.js:466:17) at require (internal/module.js:20:19) at Object.<anonymous> (/home/xxxx/xxxx/node_modules/scrypt/index.js:3:20) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:456:32) […]

如何从node.js中的函数外部访问局部variables

我在这里尝试的是访问函数外部的局部variables'htmlrows',但对node.js来说似乎并不那么容易。 var htmlrows; query.on('row', function(row) { console.log("%s |%s |%d", row.empid,row.name,row.age); htmlrows += "<tr><td>" + row.empid + "</td><td>" +row.name + "</td><td>" +row.age + "</td></tr>"; }); console.log("htmlrows outside function"); console.log(htmlrows); // console log prints 'undefined'. 你能不能让我知道如何访问函数外的“htmlrows”? 非常感谢

NodeJS和MAMP在本地机器上运行。 可能吗?

是否有可能在同一台机器上运行NodeJS和MAMP? 如果是的话,我将如何实现呢? 注意:我可以单独运行它们,但不能一起运行。 我假设使用“localhost”以及MAMP来使用NodeJS。

从node.js本地代码调用callback

我正在使用c ++编写node.js的附加组件。 这里有一些片段: class Client : public node::ObjectWrap, public someObjectObserver { public: void onAsyncMethodEnds() { Local<Value> argv[] = { Local<Value>::New(String::New("TheString")) }; this->callback->Call(Context::GetCurrent()->Global(), 1, argv); } …. private: static v8::Handle<v8::Value> BeInitiator(const v8::Arguments& args) { HandleScope scope; Client* client = ObjectWrap::Unwrap<Client>(args.This()); client->someObject->asyncMethod(client, NULL); return scope.Close(Boolean::New(true)); } static v8::Handle<v8::Value> SetCallback(const v8::Arguments& args) { HandleScope scope; Client* client = […]

电子桌面应用程序,可以打开使用代理IP地址的url

我刚刚发现关于电子js。 我想创build桌面应用程序,可以帮助打开代理服务器的网站 。 我已经尝试了下面的代码,请帮助我。请评论任何工作的例子。 const electron = require('electron'); const app = electron.app; var BrowserWindow = require('browser-window'); electron.crashReporter.start(); var mainWindow = null; app.on('window-all-closed', function() { if (process.platform != 'darwin') { app.quit(); } }); app.on('ready', function() { // without proxy simple //var win = new BrowserWindow({ width: 800, height: 600, show: false }); //win.on('closed', function() { // […]

PROTOCOL_SEQUENCE_TIMEOUT

我在c9 environnment上做了我的项目,现在我试图在本地服务器上使用它。 我的数据库运行在个人本地服务器上,看起来像mamp,在8080.我的web服务器在8888.问题是,当我尝试使用mysql.createPool函数,我有一个超时,这个错误: { Error: Handshake inactivity timeout at Handshake.<anonymous> (/Users/me/http/MyWebSite/matcha/node_modules/mysql/lib/protocol/Protocol.js:160:17) at emitNone (events.js:86:13) at Handshake.emit (events.js:185:7) at Handshake._onTimeout (/Users/me/http/MyWebSite/matcha/node_modules/mysql/lib/protocol/sequences/Sequence.js:127:8) at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at Timer.listOnTimeout (timers.js:207:5) ——————– at Protocol._enqueue (/Users/me/http/MyWebSite/matcha/node_modules/mysql/lib/protocol/Protocol.js:141:48) at Protocol.handshake (/Users/me/http/MyWebSite/matcha/node_modules/mysql/lib/protocol/Protocol.js:52:41) at PoolConnection.connect (/Users/me/http/MyWebSite/matcha/node_modules/mysql/lib/Connection.js:130:18) at Pool.getConnection (/Users/me/http/MyWebSite/matcha/node_modules/mysql/lib/Pool.js:48:16) at /Users/me/http/MyWebSite/matcha/routes/users.js:96:14 at Layer.handle [as handle_request] (/Users/me/http/MyWebSite/matcha/node_modules/express/lib/router/layer.js:95:5) at next (/Users/me/http/MyWebSite/matcha/node_modules/express/lib/router/route.js:131:13) at Route.dispatch (/Users/me/http/MyWebSite/matcha/node_modules/express/lib/router/route.js:112:3) […]