nodejs / llnode

An lldb plugin for Node.js and V8, which enables inspection of JavaScript states for insights into Node.js processes and their core dumps.
Other
1.15k stars 99 forks source link

Installation is failing in WSL, Debian and Centos #366

Closed naveenneog closed 1 year ago

naveenneog commented 4 years ago

I am trying to install llnode with lldb for debugging the core files , But unfortunately I am not able to install in any of the environments.

npm -v 3.5.2 node -v v8.10.0

naveeng@DC-PF1BB3XU:~$ sudo npm install -g llnode
npm WARN lifecycle llnode@3.2.0~preinstall: cannot run in wd %s %s (wd=%s) llnode@3.2.0 node scripts/configure.js /usr/local/lib/node_modules/.staging/llnode-cad7e691
/usr/local/bin/llnode -> /usr/local/lib/node_modules/llnode/llnode.js

> llnode@3.2.0 install /usr/local/lib/node_modules/llnode
> node scripts/install.js

gyp: config.gypi not found (cwd: /usr/local/lib/node_modules/llnode) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:340:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-17763-Microsoft
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/llnode
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! Linux 4.4.0-17763-Microsoft
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "llnode"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! llnode@3.2.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the llnode@3.2.0 install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the llnode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs llnode
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls llnode
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/naveeng/npm-debug.log
No9 commented 4 years ago

In general global installs should not be forced with sudo Here is the npm article on your options - https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

I generally prefer the manual option but YMMV https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory

mmarchini commented 4 years ago

I usually recommend folks using nvm to install Node.js because installing packages globally just works with nvm without needing to run as root, and it always downloads Node.js from nodejs.org, which is guaranteed to be an official Node.js release.

Your Node.js version (8.10.0) is End-of-Life. llnode tries to follow the Node.js release schedule, therefore the latest llnode version is not supported on Node.js v8. Furthermore, I assume you installed it with apt-get? apt-get installation of Node.js from Ubuntu/Debian default repositories is not recommended because those are not considered official Node.js releases, the versions there are heavily outdated and the installation does something that messes with gyp (see https://github.com/nodejs/llnode/issues/355#issuecomment-608160543 for more information).

Can you try installing Node.js with https://github.com/nvm-sh/nvm, and then try installing llnode without sudo?

naveenneog commented 4 years ago

Updating the node with latest node version did the trick thanks a lot @mmarchini @No9

naveenneog commented 4 years ago

Same issue in the Centos, upgrading the node version in debian has resolved. But still remains in Centos

[root@c7-naveeng-123 ~]# uname -a
Linux c7-naveeng-123 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@c7-naveeng-123 ~]# node --version
v14.6.0
[root@c7-naveeng-123 ~]# npm --version
6.14.6
[root@c7-naveeng-123 ~]# npm install -g llnode

> llnode@3.2.0 preinstall /root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode
> node scripts/configure.js

sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
Build dir is: /root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode
Looking for lldb executable...
Found lldb executable /usr/bin/lldb

Reading lldb version...
Installing llnode for /usr/bin/lldb, lldb version 3.4

Looking for llvm-config for lldb 3.4...
No llvm-config found

Looking for headers for lldb 3.4...
Could not find the headers, will download them later

Looking for shared libraries for lldb 3.4...
/usr/bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
From ldd: /usr/bin/lldb loads /usr/lib64/llvm/liblldb.so
Found liblldb.so in /usr/lib64/llvm

Cloning lldb release_34 into /root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/lldb-3.4
fatal: could not create work tree dir '/root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/lldb-3.4'.: Permission denied
child_process.js:637
    throw err;
    ^

Error: Command failed: git clone --depth 1 --branch release_34 https://github.com/llvm-mirror/lldb.git /root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/lldb-3.4
    at checkExecSyncError (child_process.js:616:11)
    at Object.execFileSync (child_process.js:634:15)
    at Object.cloneHeaders (/root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/scripts/lldb.js:47:19)
    at configureInstallation (/root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/scripts/configure.js:89:25)
    at main (/root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/scripts/configure.js:12:34)
    at Object.<anonymous> (/root/.nvm/versions/node/v14.6.0/lib/node_modules/llnode/scripts/configure.js:20:1)
    at Module._compile (internal/modules/cjs/loader.js:1236:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)
    at Module.load (internal/modules/cjs/loader.js:1085:32)
    at Function.Module._load (internal/modules/cjs/loader.js:950:14) {
  status: 128,
  signal: null,
  output: [ null, null, null ],
  pid: 32421,
  stdout: null,
  stderr: null
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! llnode@3.2.0 preinstall: `node scripts/configure.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the llnode@3.2.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-27T08_08_30_744Z-debug.log
[root@c7-naveeng-123 ~]#
mmarchini commented 4 years ago

You're still installing as root, which is not recommended by npm. If you must install as root, you might need some workaround, but I really recommend you don't install it as root (it will only generate headaches like the error you just saw). The SO question below has some more info:

https://stackoverflow.com/questions/51923277/npm-install-permission-denied-error-using-root-user/51923345

No9 commented 1 year ago

As this is stale and the resolution has been provided I am going to close. Please open another issue if you require further support.