puritys / nodejs-phplike

Porting PHP to Node.js
http://www.puritys.me/docs-blog/article-201
33 stars 12 forks source link

Error installing on Ubuntu 20.04 WSL2 #12

Open juanamm opened 4 years ago

juanamm commented 4 years ago

I have tried to install this project on Windows Linux Subsystem 2, Ubuntu 20.04 64bit and I am getting these warnings and errors:

> phplike@2.5.11 install /usr/lib/node_modules/phplike
> node-gyp rebuild

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.6.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/phplike/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/phplike/.node-gyp'
gyp ERR! System Linux 4.19.104-microsoft-standard
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/phplike
gyp ERR! node -v v14.6.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phplike@2.5.11 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phplike@2.5.11 install script.

I installed node-gyp rebuild and it didn't fix.

I also tried installing it with npm install -g phplike --unsafe and it gave these errors:

> phplike@2.5.11 install /usr/lib/node_modules/phplike
> node-gyp rebuild

make: Entering directory '/usr/lib/node_modules/phplike/build'
  CXX(target) Release/obj.target/phplike/src/cpp/exec/src/exec.o
  CXX(target) Release/obj.target/phplike/src/cpp/curl/src/util.o
  CXX(target) Release/obj.target/phplike/src/cpp/curl/src/phplikeCppCurl.o
In file included from ../src/cpp/curl/src/phplikeCppCurl.cc:5:
../src/cpp/curl/src/phplikeCppCurl.h:15:14: fatal error: curl/curl.h: No such file or directory
   15 |     #include <curl/curl.h>
      |              ^~~~~~~~~~~~~
compilation terminated.
make: *** [phplike.target.mk:133: Release/obj.target/phplike/src/cpp/curl/src/phplikeCppCurl.o] Error 1
make: Leaving directory '/usr/lib/node_modules/phplike/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.19.104-microsoft-standard
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/phplike
gyp ERR! node -v v14.6.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phplike@2.5.11 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phplike@2.5.11 install script.

I installed libcurl4-openssl-dev because in Ubuntu 20.04 libcurl-devel doesn't exist, now give me these warnings and errors:

> phplike@2.5.11 install /usr/lib/node_modules/phplike
> node-gyp rebuild

make: Entering directory '/usr/lib/node_modules/phplike/build'
  CXX(target) Release/obj.target/phplike/src/cpp/exec/src/exec.o
  CXX(target) Release/obj.target/phplike/src/cpp/curl/src/util.o
  CXX(target) Release/obj.target/phplike/src/cpp/curl/src/phplikeCppCurl.o
  CXX(target) Release/obj.target/phplike/src/cpp/md5/src/md5.o
  CXX(target) Release/obj.target/phplike/src/cpp/basic/src/string.o
  CXX(target) Release/obj.target/phplike/src/cpp/xml/src/tinyxml2.o
../src/cpp/xml/src/tinyxml2.cpp: In static member function ‘static void tinyxml2::XMLUtil::ConvertUTF32ToUTF8(long unsigned int, char*, int*)’:
../src/cpp/xml/src/tinyxml2.cpp:329:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  329 |             input >>= 6;
      |             ~~~~~~^~~~~
../src/cpp/xml/src/tinyxml2.cpp:330:9: note: here
  330 |         case 3:
      |         ^~~~
../src/cpp/xml/src/tinyxml2.cpp:333:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  333 |             input >>= 6;
      |             ~~~~~~^~~~~
../src/cpp/xml/src/tinyxml2.cpp:334:9: note: here
  334 |         case 2:
      |         ^~~~
../src/cpp/xml/src/tinyxml2.cpp:337:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  337 |             input >>= 6;
      |             ~~~~~~^~~~~
../src/cpp/xml/src/tinyxml2.cpp:338:9: note: here
  338 |         case 1:
      |         ^~~~
  CXX(target) Release/obj.target/phplike/src/cpp/socket/src/socket.o
  CXX(target) Release/obj.target/phplike/src/nodeExt/phplikeSocket.o
In file included from ../src/nodeExt/includes/common.h:4,
                 from ../src/nodeExt/phplikeSocket.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2294:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
 2294 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
      |                                                              ^
../src/nodeExt/phplikeSocket.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE nodeSocketConnect(Nan::NAN_METHOD_ARGS_TYPE)’:../src/nodeExt/phplikeSocket.cc:8:39: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
    8 |     String::Utf8Value hostname(info[0]);
      |                                       ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:3287:5: note: candidate: ‘v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)’
 3287 |     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
      |     ^~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:3287:5: note:   candidate expects 2 arguments, 1 provided
../src/nodeExt/phplikeSocket.cc:10:46: error: no matching function for call to ‘v8::Value::Uint32Value()’
   10 |     unsigned int port = info[1]->Uint32Value();
      |                                              ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2866 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE nodeSocketSend(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/nodeExt/phplikeSocket.cc:25:45: error: no matching function for call to ‘v8::Value::Uint32Value()’
   25 |     unsigned int len = info[2]->Uint32Value();
      |                                             ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2866 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc:26:48: error: no matching function for call to ‘v8::Value::Uint32Value()’
   26 |     unsigned int sockfd = info[0]->Uint32Value();
      |                                                ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2866 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc:29:49: error: no matching function for call to ‘v8::Value::ToObject()’
   29 |     Local<Object> bufferObj = info[1]->ToObject();
      |                                                 ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE nodeSocketReceive(Nan::NAN_METHOD_ARGS_TYPE)’:../src/nodeExt/phplikeSocket.cc:44:48: error: no matching function for call to ‘v8::Value::Uint32Value()’
   44 |     unsigned int sockfd = info[0]->Uint32Value();
      |                                                ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2866 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc:45:48: error: no matching function for call to ‘v8::Value::Uint32Value()’
   45 |     unsigned int length = info[1]->Uint32Value();
      |                                                ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2866 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc:46:43: error: no matching function for call to ‘v8::Value::BooleanValue()’
   46 |     bool isBinary = info[2]->BooleanValue();
      |                                           ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2858:8: note: candidate: ‘bool v8::Value::BooleanValue(v8::Isolate*) const’
 2858 |   bool BooleanValue(Isolate* isolate) const;
      |        ^~~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2858:8: note:   candidate expects 1 argument, 0 provided
../src/nodeExt/phplikeSocket.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE nodeSocketClose(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/nodeExt/phplikeSocket.cc:68:48: error: no matching function for call to ‘v8::Value::Uint32Value()’
   68 |     unsigned int sockfd = info[0]->Uint32Value();
      |                                                ^
In file included from ../src/nodeExt/includes/common.h:2,
                 from ../src/nodeExt/phplikeSocket.cc:1:
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2866 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
/root/.cache/node-gyp/14.6.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/root/.cache/node-gyp/14.6.0/include/node/node_object_wrap.h:85:78:   required from here
/root/.cache/node-gyp/14.6.0/include/node/v8.h:10867:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
10867 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/14.6.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../node_modules/nan/nan_object_wrap.h:65:61:   required from here
/root/.cache/node-gyp/14.6.0/include/node/v8.h:10867:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [phplike.target.mk:136: Release/obj.target/phplike/src/nodeExt/phplikeSocket.o] Error 1
make: Leaving directory '/usr/lib/node_modules/phplike/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.19.104-microsoft-standard
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/phplike
gyp ERR! node -v v14.6.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phplike@2.5.11 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phplike@2.5.11 install script.

VERSIONS: npm -v 6.14.6 node -v v14.6.0 node-gyp -v v7.0.0 gcc -v gcc version 9.3.0 python3 -V Python 3.8.2 curl --version curl 7.68.0

`

Monoverde888 commented 3 years ago

You need to use sudo