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

--modules-folder fails when needing to build binaries #6229

Open
danielrentz opened this issue Aug 6, 2018 · 2 comments
Open

--modules-folder fails when needing to build binaries #6229

danielrentz opened this issue Aug 6, 2018 · 2 comments
Assignees
Labels

Comments

@danielrentz
Copy link

Do you want to request a feature or report a bug?
Bug report

What is the current behavior?
Cannot install packages with binary code to custom modules directory.

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

yarn add bcrypt --modules-folder test

fails with

yarn add v1.9.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error test\bcrypt: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: test\bcrypt
Output:
Command "node-pre-gyp" not found.

Yarn creates a test directory with dependencies of bcrypt, and a node_modules directory with a .bin subdir containing node-pre-gyp.

What is the expected behavior?
bcrypt builds and installs into the test directory.

Please mention your node.js, yarn and operating system version.
node v8.11.1
yarn v1.9.4
Windows 10

@ghost ghost assigned rally25rs Aug 6, 2018
@ghost ghost added the triaged label Aug 6, 2018
@himdel
Copy link

himdel commented Aug 8, 2018

In general, --modules-folder does not work right when the path does not end in node_modules.

But even if it does, yarn still skips creating $MODULES_FOLDER/.bin completely, creating ./node_modules/.bin instead.

(Also also, yarn.lock gets updated in ./ and not $MODULES_FOLDER/.., which may or may not be a bug.)


$ yarn --version
1.9.4

$ rm -rf node_modules
$ yarn --modules-folder=/tmp/test/node_modules
(...no errors)

$ ls -a node_modules/
. .. .bin

$ ls -a /tmp/test/node_modules/.bin
ls: cannot access '/tmp/test/node_modules/.bin': No such file or directory

Maybe what's really missing is something more granular, like yarn --path-source './package.json' --path-lock '/tmp/test/yarn.lock' --modules-folder '/tmp/test/node_modules' --bin-folder '/tmp/test/node_modules/.bin but OTOH all I really wish for is yarn --from './package.json' --to '/tmp/test'

@paxperscientiam
Copy link

paxperscientiam commented Nov 1, 2018

@danielrentz my understanding is that many (most?) packages depend on the modules directory having the name "node-modules."

Not sure what you're trying to accomplish, but if you're trying to keep certain folders from your published product, you might trying a filter according to your syncronization process (eg rsync).

As a tangential point, I don't want to waste resources syncing module folders to iCloud. Luckily, iCloud ignores all directories with the suffix "noSync."

For example, my project's .yarnrc uses this directives: --modules-folder "./node-modules.noSync/node_modules". Works nicely, though requires a bit more effort to scaffold a project.

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

4 participants