无法通过节点8

时间:2018-03-09 07:00:56

标签: node.js ubuntu

此问题已在bug reports中引用,但这似乎无法解决。有几个需要contextify的软件包似乎不构建在Ubuntu和Node 8.x

npm install各种软件包上,我收到以下错误:

make: Entering directory '/src/node_modules/contextify/build'
  CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc: In static member function 'static v8::Local<v8::Context> ContextWrap::createV8Context(v8::Local<v8::Object>)':
../src/contextify.cc:131:68: warning: 'v8::Local<v8::Object> v8::Function::NewInstance() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
         Local<Object> wrapper = Nan::New(constructor)->NewInstance();
                                                                    ^
In file included from /root/.node-gyp/8.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/8.10.0/include/node/node.h:63,
                 from ../src/contextify.cc:1:
/root/.node-gyp/8.10.0/include/node/v8.h:3851:52: note: declared here
   V8_DEPRECATED("Use maybe version", Local<Object> NewInstance() const);
                                                    ^
/root/.node-gyp/8.10.0/include/node/v8config.h:318:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^
../src/contextify.cc:150:16: error: 'class v8::ObjectTemplate' has no member named 'SetAccessCheckCallbacks'
         otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,

环境是:

Ubuntu Xenial 16.04
Node v8.10.0

1 个答案:

答案 0 :(得分:2)

在mac上的节点9.11.1上有相同的错误 我能够处理它的唯一方法是:

  1. 安装NVM
  2. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash

    不要忘记将以下内容添加到.bash_profile

    [[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh  # This loads NVM
    export NVM_DIR="$HOME/.nvm"
      . "/usr/local/opt/nvm/nvm.sh"
    
    1. 然后是nvm install v6.9.5,如果您需要最新的nvm install node
    2. 然后nvm use v6.9.5,按节点双重检查--version
    3. 您文件夹中的
    4. npm install