小编use*_*713的帖子

npm install sqlite3 需要永远

我正在尝试安装 sqlite3 以在 node.js 中使用。但是,安装需要很长时间并且卡在下面的底线。

我已经等了至少 15 分钟才发生任何事情。

我也试过用--build-from-source附加安装,结果相同。

我正在安装的设备是 Raspberry Pi,重新启动并不能解决问题。其他软件包如socket.io之前已成功安装。

npm install sqlite3
npm WARN package.json ServerGPS@1.0.0 No description
npm WARN package.json ServerGPS@1.0.0 No repository field.
npm WARN package.json ServerGPS@1.0.0 No README data
/
> sqlite3@3.0.8 install /home/pi/ServerGPS/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

child_process: customFds option is deprecated, use stdio instead.
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory '/home/pi/ServerGPS/node_modules/sqlite3/build'
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3080900/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3080900/sqlite3.o
Run Code Online (Sandbox Code Playgroud)

sqlite installation node.js npm

8
推荐指数
2
解决办法
2056
查看次数

在 Node.js 退出之前写入 .txt 文件

我希望我的服务器在节点退出时保存一些重要数据并在下次加载它们。

我尝试了这个问题的答案所建议的内容,但服务器似乎在能够写入文件之前关闭了。

这是我正在尝试的确切代码:

process.stdin.resume();

function exitHandler(options, err) {
    if(!serverUp){return;}
    serverUp = false;
    fs.writeFile('server.txt', String(search_index),function (err) {
        console.log("debug") // <-- This doesn't happen
        process.exit();
    });   
}

//do something when app is closing
process.on('exit', exitHandler.bind(null,{cleanup:true}));

//catches ctrl+c event
process.on('SIGINT', exitHandler.bind(null, {exit:true}));

//catches uncaught exceptions
process.on('uncaughtException', exitHandler.bind(null, {exit:true}));
Run Code Online (Sandbox Code Playgroud)

javascript text exit writefile node.js

5
推荐指数
1
解决办法
3384
查看次数

添加一行时,jQuery 数据表滚动到底部

每当添加一行时,我希望我的 DataTable 滚动到底部。我已经针对这个问题尝试了多种修复方法,但都没有奏效。

经测试的解决方案:

其中...

我认为,从别人我的情况下分开,是我用DataTableD大写。

无论如何,这是我当前的代码:

var table = $('#example').DataTable({
          "createdRow": function( row, data, dataIndex ) 
          {
             $(row).attr('id', 'row-' + dataIndex);
          },
          "bPaginate": false,
        "bLengthChange": false,
        "bFilter": false,
        "bInfo": false,
        "bAutoWidth": false,
        "scrollY":        $(window).height()/1.5,
        "scrollCollapse": true,
        "paging":         false,
   });

   for(var i = 1; i <= 20; i++){
      table.row.add([ 
         i,
         'action'+i,
      ]);
   }  

   table.draw();

   table.rowReordering();
Run Code Online (Sandbox Code Playgroud)

如果表格在添加新行时滚动到底部,那就太好了。

html javascript jquery scroll datatables

3
推荐指数
1
解决办法
7077
查看次数

标签 统计

javascript ×2

node.js ×2

datatables ×1

exit ×1

html ×1

installation ×1

jquery ×1

npm ×1

scroll ×1

sqlite ×1

text ×1

writefile ×1