问题:

我尝试将node-vlc与nw.js(v0.12.0-alpha2)一起使用。 当我启动我的应用程序没有nw.js它工作,但当我用nw.js启动它时,我收到一个错误:

未捕获的错误:模块没有自行注册。“,来源:/home/alexis/Bureau/dev/jukebox/node_modules/vlc/node_modules/ffi/node_modules/bindings/bindings.js(84)

我用nw-gyp尝试了一些命令,但它无法帮助我。 我在Ubuntu 14,64位。

I try to use node-vlc with nw.js (v0.12.0-alpha2).When i launch my app without nw.js it works, but when i launch it with nw.js i got an error:Uncaught Error: Module did not self-register.”, source: /home/alexis/Bureau/dev/jukebox/node_modules/vlc/node_modules/ffi/node_modules/bindings/bindings.js (84)I tried some commands with nw-gyp but it couldn’t help me.I am on Ubuntu 14, 64-bit.

问题:

尝试使用gulp-babel时出现以下错误:

错误:无法找到相对于目录“/ Users / username”的预设“es2015”

我在全局和本地安装了es2015预设,因此无法理解为什么这会成为一个问题。

下面是我的gulp设置和package.json。

var babel = require('gulp-babel');
var es2015 = require('babel-preset-es2015');

gulp.task('babel', function() {
    return gulp.src('./app/main.js')
    .pipe(babel({
        presets: [es2015]
    }))
    .pipe(gulp.dest('dist'));
});

的package.json

  "devDependencies": {
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-es2015-node5": "^1.1.1",
    "browser-sync": "^2.11.0",
    "gulp": "^3.9.0",
    "gulp-babel": "^6.1.1",
    "gulp-stylus": "^2.2.0"
  }

我使用的是node v5.1.0和babel v6.4.0

这是终端输出

终端输出

I get the following error when trying to use gulp-babel:Error: Couldn’t find preset “es2015” relative to directory “/Users/username”I have the es2015 preset installed globally and locally so can’t see why this would be an issue.Below is my gulp set up and package.json.Package.jsonI am using node v5.1.0 and babel v6.4.0Here is the terminal ouputterminal output

问题:

我跟着: Node Beginner Book

使用另一个SO帖子的代码测试后:

var Fs = require('fs');

var dirs = ['tmp'];
var index;
var stats;

for (index = 0; index < dirs.length; ++index)
{
    try
    {
        stats = Fs.lstatSync(dirs[index]);
        console.log(dirs[index] + ": is a directory? " + stats.isDirectory());
    }
    catch (e)
    {
        console.log(dirs[index] + ": " + e);
    }
}

错误仍然存​​在:

错误:ENOENT,没有这样的文件或目录’tmp’

app目录结构

tmp的权限是777。

requestHandlers.js

var querystring = require("querystring"),
    fs = require("fs");

function start(response, postData) {
  console.log("Request handler 'start' was called.");

  var body = '<html>'+
    '<head>'+
    '<meta http-equiv="Content-Type" '+
    'content="text/html; charset=UTF-8" />'+
    '<style>input{display: block; margin: 1em 0;}</style>'+
    '</head>'+
    '<body>'+
    '<form action="/upload" method="post">'+
    '<textarea name="text" rows="20" cols="60"></textarea>'+
    '<input type="submit" value="Submit text" />'+
    '</form>'+
    '</body>'+
    '</html>';

    response.writeHead(200, {"Content-Type": "text/html"});
    response.write(body);
    response.end();
}

function upload(response, postData) {
  console.log("Request handler 'upload' was called.");
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("You've sent the text: "+
  querystring.parse(postData).text);
  response.end();
}

function show(response, postData) {
  console.log("Request handler 'show' was called.");
  fs.readFile("/tmp/test.jpg", "binary", function(error, file) {
    if(error) {
      response.writeHead(500, {"Content-Type": "text/plain"});
      response.write(error + "\n");
      response.end();
    } else {
      response.writeHead(200, {"Content-Type": "image/jpg"});
      response.write(file, "binary");
      response.end();
    }
  });
}

exports.start = start;
exports.upload = upload;
exports.show = show;

Index.js

var server = require("./server");
var router = require("./router");
var requestHandlers = require("./requestHandlers");

var handle = {}
handle["/"] = requestHandlers.start;
handle["/start"] = requestHandlers.start;
handle["/upload"] = requestHandlers.upload;
handle["/show"] = requestHandlers.show;

server.start(router.route, handle);

有点难过,任何帮助赞赏。

I’m following along with: The Node Beginner BookAfter testing with the code from another SO post:The error persist:Error: ENOENT, no such file or directory ‘tmp’The permissions on tmp are 777.requestHandlers.jsIndex.jsA little stumped, any help appreciated.

问题:

有没有办法在node.js堆栈错误中获得超过10行?

function a() { dieInHell(); }
function b() { a(); }
function c() { b(); }
function d() { c(); }
function e() { d(); }
function f() { e(); }
function g() { f(); }
function h() { g(); }
function i() { h(); }
function j() { i(); }
function k() { j(); }
function l() { k(); }
function m() { l(); }
function n() { m(); }
function o() { n(); }
function p() { o(); }
function q() { p(); }

try {
    q();
}
catch(e) {
    console.log(e.stack);
}

显示:

$ node debug.js 
ReferenceError: dieInHell is not defined
    at a (/Users/julien/tmp/debug.js:2:5)
    at b (/Users/julien/tmp/debug.js:6:5)
    at c (/Users/julien/tmp/debug.js:10:5)
    at d (/Users/julien/tmp/debug.js:14:5)
    at e (/Users/julien/tmp/debug.js:18:5)
    at f (/Users/julien/tmp/debug.js:22:5)
    at g (/Users/julien/tmp/debug.js:26:5)
    at h (/Users/julien/tmp/debug.js:30:5)
    at i (/Users/julien/tmp/debug.js:34:5)
    at j (/Users/julien/tmp/debug.js:38:5)

有没有办法获得超过10个电话?

Is there a way to get more than 10 lines in a node.js stack error?shows :Is there a way to get more than 10 calls?

问题:

我通过apt-get install和所有依赖项安装了节点js和npm,然后我安装了browserify

npm install browserify -g

它经历了整个过程,看起来它安装得正确,但是当我尝试按照这个演练做一个简单的捆绑

我收到错误:

/ usr / bin / env:node:没有这样的文件或目录

在此输入图像描述

I installed node js and npm via apt-get install and all of the dependencies, then I installed browserifyit goes through the process and it seems like it installed correctly, but when I try to do a simple bundle per this walkthroughI get the error:/usr/bin/env: node: No such file or directory