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

Native node module is not compiled by yarn install #5814

Open
Venemo opened this issue May 13, 2018 · 3 comments
Open

Native node module is not compiled by yarn install #5814

Venemo opened this issue May 13, 2018 · 3 comments
Assignees
Labels

Comments

@Venemo
Copy link

Venemo commented May 13, 2018

Do you want to request a feature or report a bug?
Bug, originally reported against node-lmdb: Venemo/node-lmdb#126

What is the current behavior?
yarn install does not compile a native node module in the same way as npm install does. It is also possible that node-lmdb is somehow incorrectly configured. If this is the case, please help figure out how to configure it in such a way that works with yarn.

Currently we just see this error: Error: Could not locate the bindings file. Compiled binding file is not there, but should be, and it's there if installed with npm install.

If the current behavior is a bug, please provide the steps to reproduce.

@chrbala has kindly provided a way to reproduce this, I'm using his stuff here.

git clone https://github.com/chrbala/node-lmdb-install-bug
cd node-lmdb-install-bug
yarn install

What is the expected behavior?
yarn install should compile the native module in the same manner as npm install

Please mention your node.js, yarn and operating system version.

  • node.js: v8.11.0
  • yarn: v1.6.0
  • operating system: Fedora 27 (issue also occours on Ubuntu according to the guy who reported this to me.)
@rally25rs
Copy link
Contributor

unlike npm, yarn runs the install scripts in parallel, so I think your custom install script is trying to import node-lmdb while it's still building. If you look at the output:

~/Projects/node-lmdb-install-bug (master *) 🐒   yarn
yarn install v1.6.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[1/2] ⠂ node-lmdb
[2/2] ⠂ test-package
[-/2] ⠂ waiting...
[-/2] ⠂ waiting...
error /Users/jvalore/Projects/node-lmdb-install-bug/node_modules/test-package: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /Users/jvalore/Projects/node-lmdb-install-bug/node_modules/test-package
Output:
/Users/jvalore/Projects/node-lmdb-install-bug/node_modules/bindings/bindings.js:96
  throw err
  ^

Error: Could not locate the bindings file. Tried:
...

this section:

[4/4] 📃  Building fresh packages...
[1/2] ⠂ node-lmdb
[2/2] ⠂ test-package

shows that both those scripts are executing at the same time.

@Venemo
Copy link
Author

Venemo commented May 14, 2018

@rally25rs Thanks for the reply! What is the correct solution to this issue then? Can you specify the dependency in such a way that it will be built before the install script is run?

@chrbala
Copy link

chrbala commented May 21, 2018

I currently have a separate build step that I run with Lerna scripts that has to be run after the yarn installation is complete. So a a full installation looks like:

yarn install
yarn run after-install (alias of lerna run after-install)

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

No branches or pull requests

3 participants