Skip to content

Error: Could not locate the bindings file #29

Open

Description

@wdgrantham

I tried to install and use node-postal today and continue to get an error. I'm using MacOS Version 11.2.3 (Big Sur), node v12.16.2. I can run libpostal cli via terminal just fine, so I'm pretty sure I did the installation of libpostal correctly. Any suggestions?

/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/bindings/bindings.js:135
  throw err;
  ^

Error: Could not locate the bindings file. Tried:
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/Debug/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/Release/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/out/Debug/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/Debug/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/out/Release/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/Release/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/default/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/compiled/12.16.2/darwin/x64/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/addon-build/release/install-root/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/addon-build/debug/install-root/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/addon-build/default/install-root/expand.node
 → /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/lib/binding/node-v72-darwin-x64/expand.node
    at bindings (/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/index.js:3:32)

Here's the output of node-gyp rebuild as requested in the read me:

 % node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@8.0.0
gyp info using node@12.16.2 | darwin | x64
gyp info find Python using Python version 3.7.3 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/wyattgrantham/Library/Caches/node-gyp/12.16.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/wyattgrantham/Library/Caches/node-gyp/12.16.2',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/wyattgrantham/Library/Caches/node-gyp/12.16.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp) 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/local/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp
gyp ERR! node -v v12.16.2
gyp ERR! node-gyp -v v8.0.0
gyp ERR! not ok 

Activity

  1. glebsts commented on Jul 1, 2021

    @glebsts

    I debugged similar issue today in my lerna monorepo and found that I need to npm install node-postal separately because it has additional scripts during install not run by lerna. Most useful command for me was find node_modules/node-postal/ -type f -printf "%T@ %p\n" | sort -nr | cut -d\ -f2- which I run inside CI process on different steps while testing and building docker image. So please check if .node files are there after whatever you use as npm install.

  2. thehappycoder commented on Sep 30, 2021

    @thehappycoder

    I also got the same error with node-16.10.0. I've got Apple m1 machine. Works fine with node-15.

    With node-16, I did the following:

    brew install curl autoconf automake libtool pkg-config
    git clone https://github.com/openvenues/libpostal
    cd libpostal
    ./bootstrap.sh
    ./configure --disable-sse2
    # Had to add sudo before make
    sudo make
    sudo make install
    sudo npm install -g node-gyp
    yarn add node-postal
    

    Output of make install:

    % sudo make install
    Making install in src
    ./libpostal_data download all /usr/local/share/libpostal
    Checking for new libpostal data file...
    libpostal data file up to date
    Checking for new libpostal parser data file...
    libpostal parser data file up to date
    Checking for new libpostal language classifier data file...
    libpostal language classifier data file up to date
     .././install-sh -c -d '/usr/local/bin'
     /usr/bin/install -c libpostal_data '/usr/local/bin'
     .././install-sh -c -d '/usr/local/lib'
     /bin/sh ../libtool   --mode=install /usr/bin/install -c   libpostal.la '/usr/local/lib'
    libtool: install: /usr/bin/install -c .libs/libpostal.1.dylib /usr/local/lib/libpostal.1.dylib
    libtool: install: (cd /usr/local/lib && { ln -s -f libpostal.1.dylib libpostal.dylib || { rm -f libpostal.dylib && ln -s libpostal.1.dylib libpostal.dylib; }; })
    libtool: install: /usr/bin/install -c .libs/libpostal.lai /usr/local/lib/libpostal.la
    libtool: install: /usr/bin/install -c .libs/libpostal.a /usr/local/lib/libpostal.a
    libtool: install: chmod 644 /usr/local/lib/libpostal.a
    libtool: install: ranlib /usr/local/lib/libpostal.a
     .././install-sh -c -d '/usr/local/include/libpostal'
     /usr/bin/install -c -m 644 libpostal.h '/usr/local/include/libpostal'
    Making install in test
    make[2]: Nothing to be done for `install-exec-am'.
    make[2]: Nothing to be done for `install-data-am'.
    make[2]: Nothing to be done for `install-exec-am'.
     ./install-sh -c -d '/usr/local/lib/pkgconfig'
     /usr/bin/install -c -m 644 libpostal.pc '/usr/local/lib/pkgconfig'
    

    Maybe because there is nothing for 16.10.0 here?

    ls ~/.node-gyp 
    15.14.0	15.8.0
    
  3. kyle-villeneuve commented on Nov 5, 2021

    @kyle-villeneuve

    running npm rebuild --update-binary fixed this for me, even though I'm using yarn with my project (it doesn't add a package.lock.json file)

  4. zack09holland commented on Jan 22, 2024

    @zack09holland
    Contributor

    @thehappycoder I know this is years late but wanted to ping you to let you know that I had the same issue with Node v16+ but found a fix for it that was just merged in today. (#44).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions