dalai
dalai copied to clipboard
Ubuntu 20.04 error: Unexpected token '?'
On Ubuntu 20.04 I get the following warnings and error when trying to run npx dalai llama
:
(base) riccardo@riccardo-Aspire-A317-51G:~$ npx dalai llama
../src/unix/pty.cc: In function ‘void pty_after_waitpid(uv_async_t*)’:
../src/unix/pty.cc:512:43: warning: ‘void* memset(void*, int, size_t)’ writing to an object of type ‘class Nan::Persistent<v8::Function>’ with no trivial copy-assignment [-Wclass-memaccess]
512 | memset(&baton->cb, -1, sizeof(baton->cb));
| ^
In file included from ../../nan/nan.h:409,
from ../src/unix/pty.cc:20:
../../nan/nan_persistent_12_inl.h:12:40: note: ‘class Nan::Persistent<v8::Function>’ declared here
12 | template<typename T, typename M> class Persistent :
| ^~~~~~~~~~
In file included from ../../nan/nan.h:60,
from ../src/unix/pty.cc:20:
../src/unix/pty.cc: At global scope:
/home/riccardo/.cache/node-gyp/12.22.12/include/node/node.h:736:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
736 | (node::addon_register_func) (regfunc), \
| ^
/home/riccardo/.cache/node-gyp/12.22.12/include/node/node.h:770:3: note: in expansion of macro ‘NODE_MODULE_X’
770 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
| ^~~~~~~~~~~~~
../src/unix/pty.cc:734:1: note: in expansion of macro ‘NODE_MODULE’
734 | NODE_MODULE(pty, init)
| ^~~~~~~~~~~
Unexpected token '?'
Node and npx versions:
(base) riccardo@riccardo-Aspire-A317-51G:~$ node -v
v12.22.12
(base) riccardo@riccardo-Aspire-A317-51G:~$ npx -v
6.14.16
v12.22.12
Your Node version is too old, Ubuntu's repos ship with a very old Node version. You either have to get nvm
or add a PPA to get newer versions. #42