Create-react-app: Adding a --no-bin-links option

Created on 16 Jan 2017  Â·  28Comments  Â·  Source: facebook/create-react-app

Hi !

Is there a way to add a NPM-like --no-bin-links option.
It is used by VM users who share folders between a host and a VM.

Example:
Vagrant

claimed starter

Most helpful comment

@gaearon This is a common bug with npm with --no-bin-links, it typically involves dependency cycles see npm#9224.

When you have dependencies that have cycles in the graph the symlinks tend to solve the problem but when you tell npm it can't symlink it blows up recursing forever until the npm call stack is exhausted.

The desire for the --no-bin-links option typically comes with working on windows (where symlinking doesn't exist or requires elevation), or with vagrants vms (shared folders between a linux vm and a windows host) has issues with creating/maintaining symlinks.

My first guess would be that there's a dependency cycle happening somewhere in one of the many dependencies of react-scripts but realistically that could be upstream in anything or local to CRA.

All 28 comments

@sofianegargouri

As a side note, you're going to have a hellish time running Jest in your setup. The project analysis in jest last time i used it was stat() heavy. One of the areas the shared folder situation fails miserably in solutions like Vagrant (On Virtualbox at least) is IOPS.

It may have changed since my last time using jest but I know it was this slow IOPS problem that drove me to use a native linux machine for development instead of a VM from windows.

I'm not entirely sure what you're asking. Can you provide a more detailed feature request? What would this flag do, compared to how we're doing things now?

I guess that actually you are creating some links while running the commands, but it can break when there are shared folders between 2 different systems (as for Vagrant users). To prevent that, NPM added an option to prevent those Symlinks.

As written in their documentation:

The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.

I don't know if it is understandable, but when I tried to create a project, I had many conflicts with symlinks that prevented me from using your amazing tool.

Oh, I see. So you'd like create-react-app myapp --no-bin-links to pass that option down to npm install call, is that correct?

This should be an easy first PR.

I don't know if it's only needed in npm install as I wasn't able to go further

If Yarn supports it then in both. Check if Yarn supports it by inspecting its source :wink:

I actually tried to add "--no-bin-links" to this line, however I ended up with this:

Installing react-scripts...
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save-dev" "--save-exact" "--no-bin-links" "react-scripts"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10

npm ERR! Maximum call stack size exceeded

File a bug with npm?

@gaearon This is a common bug with npm with --no-bin-links, it typically involves dependency cycles see npm#9224.

When you have dependencies that have cycles in the graph the symlinks tend to solve the problem but when you tell npm it can't symlink it blows up recursing forever until the npm call stack is exhausted.

The desire for the --no-bin-links option typically comes with working on windows (where symlinking doesn't exist or requires elevation), or with vagrants vms (shared folders between a linux vm and a windows host) has issues with creating/maintaining symlinks.

My first guess would be that there's a dependency cycle happening somewhere in one of the many dependencies of react-scripts but realistically that could be upstream in anything or local to CRA.

Thanks for explaining.

Here they seem to suggest that it's a problem with npm 3 and/or Node >= 6. At the moment I can't verify it, i'll give it a look tonight

I'd like to take this up!

There is another option that worked pretty well for me, on Vagrant

config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end

Execute CMD with admin rights.

I'm going to free this issue back up, @shubheksha let us know if you'd still like to work on it!

@Timer If you can brief me about what is the final expected result. I can take up this!

Any news on this ? It is quite crucial to use CRA on Vagrant boxes

Feel free to submit a PR @stilllife00; and sorry about never responding @anilreddykatta!

See expectation here: https://github.com/facebookincubator/create-react-app/issues/1394#issuecomment-279176314

@Timer @gaearon
I'd like to give this issue a try if still available. This will be my first contribution; I'm trying to get into open source.

congrats im prou of a fellow franklin

On Wed, Feb 14, 2018 at 3:43 PM, Tyler D Franklin notifications@github.com
wrote:

@Timer https://github.com/timer @gaearon https://github.com/gaearon
I'd like to give this issue a try if still available. This will be my
first contribution; I'm trying to get into open source.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/create-react-app/issues/1394#issuecomment-365769710,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT6QPqpYwLyouqxBxX8fK-Hkz4pDTHuhks5tU2GcgaJpZM4LkkHA
.

@tdfranklin Go for it!

@iansu
Thank you! I "think" I've resolved the issue, however I wanted to do some testing to make sure everything was getting passed down correctly and running into some trouble I was hoping you could advise on. I apologize in advance if I'm overlooking an obvious answer, but once I've saved the code, how can I install it to test the command line args?

On my other project, I would just run npm install -g from the project directory then go test the commands in another directory, but I get an error with this project because there is no package name in the package.json (I get a similar error trying to run yarn add /path/create-react-app). I'm new to using Yarn, so I might be missing something obvious....

In the contributing.md file, I see you say to run yarn create-react-app my-app to test the end-to-end flow of the CLI, but I get an error with that because I have uncommitted changes. Do I need to actually commit before I'm able to test or is there a better way to test the CLI commands?

That is probably the best way to test your changes. You can commit your changes and then, if you need to make additional changes, create more commits. It's fine to make multiple commits. We squash them all into a single commit when we merge them anyway.

Ok, great, will do! Thank you for the help!

@iansu
Just wanted to let you know that I submitted a PR:
https://github.com/facebook/create-react-app/pull/4036

However, I see that the CI tests failed, but it looked to be some other issue. If there's something else I need to fix or do, please let me know! Thank you.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oltsa picture oltsa  Â·  3Comments

adrice727 picture adrice727  Â·  3Comments

Aranir picture Aranir  Â·  3Comments

fson picture fson  Â·  3Comments

fson picture fson  Â·  3Comments