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

Adding a --no-bin-links option #1394

Open
sofianegargouri opened this issue Jan 16, 2017 · 28 comments
Open

Adding a --no-bin-links option #1394

sofianegargouri opened this issue Jan 16, 2017 · 28 comments

Comments

@sofianegargouri
Copy link

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

@Reanmachine
Copy link

@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.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

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?

@sofianegargouri
Copy link
Author

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.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

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?

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

This should be an easy first PR.

@sofianegargouri
Copy link
Author

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

@gaearon
Copy link
Contributor

gaearon commented Feb 12, 2017

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

@jkomyno
Copy link

jkomyno commented Feb 14, 2017

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

@gaearon
Copy link
Contributor

gaearon commented Feb 15, 2017

File a bug with npm?

@Reanmachine
Copy link

@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.

@gaearon
Copy link
Contributor

gaearon commented Feb 15, 2017

Thanks for explaining.

@jkomyno
Copy link

jkomyno commented Feb 15, 2017

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

@shubheksha
Copy link
Contributor

I'd like to take this up!

@vinizinmoraes
Copy link

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.

@Timer
Copy link
Contributor

Timer commented Apr 25, 2017

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

@anilreddykatta
Copy link
Contributor

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

@pastinepolenta
Copy link

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

@Timer
Copy link
Contributor

Timer commented Nov 6, 2017

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

See expectation here: #1394 (comment)

@gaearon gaearon modified the milestones: 1.x, 2.x Jan 8, 2018
@tdfranklin
Copy link

@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.

@calihack81
Copy link

calihack81 commented Feb 14, 2018 via email

@iansu
Copy link
Contributor

iansu commented Feb 15, 2018

@tdfranklin Go for it!

@tdfranklin
Copy link

@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?

@iansu
Copy link
Contributor

iansu commented Feb 16, 2018

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.

@tdfranklin
Copy link

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

@tdfranklin
Copy link

@iansu
Just wanted to let you know that I submitted a PR:
#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.

@Timer Timer removed this from the 2.x milestone Nov 2, 2018
@stale
Copy link

stale bot commented Dec 2, 2018

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.

@stale stale bot added the stale label Dec 2, 2018
@stale
Copy link

stale bot commented Dec 8, 2018

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.

@stale stale bot closed this as completed Dec 8, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
@petetnt petetnt reopened this Jul 9, 2019
@stale stale bot removed the stale label Jul 9, 2019
@petetnt
Copy link
Contributor

petetnt commented Jul 9, 2019

Another PR pending for this at #7243

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

No branches or pull requests