NPM Err on NPM i
keirak420 opened this issue · 3 comments
I have looked everywhere and I am unable to find a solution. Would someone please assist? Ubuntu 22.04.1 LTS (jammy)
~/Downloads/git/freelook$ npm i
npm WARN deprecated electron-osx-sign@0.6.0: Please use @electron/osx-sign moving forward. Be aware the API is slightly different
npm ERR! code 1
npm ERR! path /home/xxxx/Downloads/git/freelook/node_modules/keyboard-layout
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! make: Entering directory '/home/xxx/Downloads/git/freelook/node_modules/keyboard-layout/build'
npm ERR! CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager.o
npm ERR! CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
npm ERR! make: Leaving directory '/home/xxx/Downloads/git/freelook/node_modules/keyboard-layout/build'
I've seen this error on the Github action as well.
I am currently using MacOS for development, will see if can setup a virtual machine for ubuntu. Meantime if someone can fix this for me, please raise a PR. Thanks
if you look at the error details, actually the following line cause the problem
npm ERR! ../src/keyboard-layout-manager.h:7:10: fatal error: X11/Xlib.h: No such file or directory
that means the ubuntu you installed don't have the libx11 lib. Also there is another lib missing, run following command to install the missing libs will allow the electron to build the keyboard-layout.
sudo apt install libx11-dev libxkbfile-dev
I'll update the README for this error if anyone facing the same issue.
some logs for this issue
npm ERR! code 1
npm ERR! path /home/parallels/Source/freelook/node_modules/keyboard-layout
npm ERR! command failed
npm ERR! command sh /tmp/install-6f2efed8.sh
npm ERR! make: Entering directory '/home/parallels/Source/freelook/node_modules/keyboard-layout/build'
npm ERR! CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager.o
npm ERR! make: Leaving directory '/home/parallels/Source/freelook/node_modules/keyboard-layout/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.17.1 | linux | arm64
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/parallels/Source/freelook/node_modules/keyboard-layout/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/parallels/.cache/node-gyp/16.17.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/parallels/.cache/node-gyp/16.17.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/parallels/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/parallels/Source/freelook/node_modules/keyboard-layout',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/keyboard-layout-manager.cc:1:
npm ERR! ../src/keyboard-layout-manager.h:7:10: fatal error: X11/Xlib.h: No such file or directory
npm ERR! 7 | #include <X11/Xlib.h>
npm ERR! | ^~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [keyboard-layout-manager.target.mk:114: Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.13.0-25-generic
npm ERR! gyp ERR! command "/home/parallels/.nvm/versions/node/v16.17.1/bin/node" "/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/parallels/Source/freelook/node_modules/keyboard-layout
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
sudo apt install libx11-dev
npm WARN deprecated electron-osx-sign@0.6.0: Please use @electron/osx-sign moving forward. Be aware the API is slightly different
npm ERR! code 1
npm ERR! path /home/parallels/Source/freelook/node_modules/keyboard-layout
npm ERR! command failed
npm ERR! command sh /tmp/install-48edd4d6.sh
npm ERR! make: Entering directory '/home/parallels/Source/freelook/node_modules/keyboard-layout/build'
npm ERR! CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager.o
npm ERR! CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
npm ERR! make: Leaving directory '/home/parallels/Source/freelook/node_modules/keyboard-layout/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.17.1 | linux | arm64
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/parallels/Source/freelook/node_modules/keyboard-layout/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/parallels/.cache/node-gyp/16.17.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/parallels/.cache/node-gyp/16.17.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/parallels/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/parallels/Source/freelook/node_modules/keyboard-layout',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/keyboard-layout-manager-linux.cc:5:10: fatal error: X11/extensions/XKBrules.h: No such file or directory
npm ERR! 5 | #include <X11/extensions/XKBrules.h>
npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [keyboard-layout-manager.target.mk:114: Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.13.0-25-generic
npm ERR! gyp ERR! command "/home/parallels/.nvm/versions/node/v16.17.1/bin/node" "/home/parallels/.nvm/versions/node/v16.17.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/parallels/Source/freelook/node_modules/keyboard-layout
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
sudo apt install libxkbfile-dev