Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Could not locate the bindings file #170

Open
matthewbschneider opened this issue Jan 28, 2017 · 8 comments
Open

ERROR: Could not locate the bindings file #170

matthewbschneider opened this issue Jan 28, 2017 · 8 comments

Comments

@matthewbschneider
Copy link

Getting the following error on Debian 3.16.7 GNU/Linux

Error: Could not locate the bindings file. Tried:
→ /node_modules/node-expat/build/node_expat.node
→ /node_modules/node-expat/build/Debug/node_expat.node
→ /node_modules/node-expat/build/Release/node_expat.node
→ /node_modules/node-expat/out/Debug/node_expat.node
→ /node_modules/node-expat/Debug/node_expat.node
→ /node_modules/node-expat/out/Release/node_expat.node
→ /node_modules/node-expat/Release/node_expat.node
→ /node_modules/node-expat/build/default/node_expat.node
→ /node_modules/node-expat/compiled/4.4.5/linux/x64/node_expat.node
at bindings (/node_modules/node-expat/node_modules/bindings/bindings.js:88:9)
at Object. (/node_modules/node-expat/lib/node-expat.js:4:32)

@astro
Copy link
Collaborator

astro commented Jan 30, 2017

find . -name node_expat.node

@matthewbschneider
Copy link
Author

@astro

$ find . -name node_expat.node
./node_modules/node-expat/build/Release/node_expat.node
./node_modules/node-expat/build/Release/obj.target/node_expat.node

@astro
Copy link
Collaborator

astro commented Feb 1, 2017

looks alright?

@BradZzz
Copy link

BradZzz commented May 4, 2017

I am also seeing this error when uploading to Heroku. Would be interested to know how to fix instead of trying a new library

@gupshuprenuka
Copy link

I am also facing this issue on Lambda

@chrisweight
Copy link

And on Travis CI...

@UncleGus
Copy link

To fix this, I went into the node-expat folder in my node_modules folder, then I ran a node-gyp rebuild there. At first it complained about my npm_config_node_gyp variable, which was pointing at the node-gyp package folder itself, so I amended it to point at the bin\node-gyp.js file itself. Like this:
export npm_config_node_gyp=C:\\ProgramData\\nvm\\v8.13.0\\node_modules\\npm\\node_modules\\node_modules\\node-gyp\\bin\\node-gyp.js

@azjgard
Copy link

azjgard commented Apr 29, 2020

For anyone from Google that come across this issue and is using Webpack:

I encountered this error when trying to deploy some code using the Serverless framework to a Lambda on AWS; the error was being thrown when Webpack was attempting to bundle everything.

I discovered that the problem stemmed from Webpack's inability to bundle native modules. I was able to fix it with two steps:

  1. Including the below in my webpack.config.js to tell Webpack that node-expat is an external module that shouldn't be bundled:
module.exports = {
  ...
  externals: ["node-expat"]
};
  1. Including the below in my serverless.yml to tell Serverless that node-expat should be packaged into the node_modules included in the deployed .zip file:
custom:
  webpack:
    includeModules:
      forceInclude:
        - node-expat

Replace step 2 with whatever is necessary to make sure that node_modules/node-expat is available to your Node process at runtime, since it won't be in the bundle that Webpack spits out.

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

No branches or pull requests

7 participants