我如何在ubuntu中运行“node index.js”

时间:2016-05-02 04:44:52

标签: javascript node.js ubuntu

这是在windows环境中创建的,如何将其运行到ubuntu环境中。

stayinc/server$ node index.js 

util.js:538
  ctor.prototype = Object.create(superCtor.prototype, {
                                          ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.exports.inherits (util.js:538:43)
    at Object. (/media/subhasis/3C92D33592D2F27E/LocalProject/stayinc/server/node_modules/mongodb/lib/gridfs-stream/download.js:46:6)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object. (/media/subhasis/3C92D33592D2F27E/LocalProject/stayinc/server/node_modules/mongodb/lib/gridfs-stream/index.js:2:30)
    at Module._compile (module.js:449:26)

2 个答案:

答案 0 :(得分:1)

在运行“node index.js”之前,您是否运行了以下命令?

#include <tuple>
#include <utility>

template<typename...Rs>
struct S
{
    void store(std::tuple<Rs*...> rs)
    {
        rs_ = rs;
    }

    void store2(Rs*...rs)
    {
        rs_ = std::make_tuple<Rs*...>(rs...); // This is the guy that breaks
    }

private:
    std::tuple<Rs*...> rs_;
};

struct B
{};

struct A : S<B, B>
{};

int main()
{
    auto *b1 = new B;
    auto *b2 = new B;
    auto *a1 = new A;

    a1->store(std::make_tuple(b1, b2));   // This works
    a1->store2(b1, b2);    // How can I get this to work?
                           // (It causes an error in std::make_tuple of store2 above)
}

答案 1 :(得分:0)

It must be an issue with an outdated version of node.js.

You could check the current version by typing in

node -v

I suppose it would output something like 0.8, which is pretty old.