此问题已在 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
最佳答案
在 Mac 上的 Node 9.11.1 上出现相同的错误 我能够处理它的唯一方法如下:
- 安装 NVM
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"
- 然后
nvm install v6.9.5
,如果您需要最新的nvm install node
- 然后
nvm使用v6.9.5
,通过node --version仔细检查 npm install
在您的文件夹中
关于node.js - 无法在 ubuntu 上使用 Node 8 构建 contextify,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49188238/