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

Supported force-npm option for create-react-native-app. #307

Merged
merged 2 commits into from
Jul 17, 2017

Conversation

metheglin
Copy link
Contributor

I'd like to add --force-npm option for create-react-native-app command.
This is because I usually use yarn but it gives an error when starting react native. I added another issue for yarn for this problem.
yarnpkg/yarn#3925

As current workaround, I'd like to force npm at starting the project.
How do you think?

@ide
Copy link
Member

ide commented Jul 13, 2017

Just throwing out another idea, would --package-manager=npm be a preferable interface? That way you could provide a path to a specific version of a package manager too, use ied, and so on. Not sure if it's actually something people want though.

@metheglin
Copy link
Contributor Author

@ide
Thanks. That sounds much better.
I revised with --package-manager option. It supports specific path to run manager command.
A subtle point is the last one, if specific path which doesn't contain yarn and npm in itself is specified, this version consider it as npm as default.(so that the last one fails with test: --save-dev: unknown operand)
Please check this.

% yarn --version
0.27.5
% node index.js sample-app
Creating a new React Native app in /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app.

Using package manager as yarnpkg with yarn interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...

yarn add v0.27.5
...
% node index.js sample-app --package-manager yarn
Creating a new React Native app in /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app.

Using package manager as yarn with yarn interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...

yarn add v0.27.5
...
% node index.js sample-app --package-manager /usr/local/Cellar/yarn/0.18.1/bin/yarn
Creating a new React Native app in /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app.

Using package manager as /usr/local/Cellar/yarn/0.18.1/bin/yarn with yarn interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...

yarn add v0.18.1
...
# 
# Disabled yarn
# 
% rm -i /usr/local/bin/yarnpkg
% which yarnpkg
yarnpkg not found

% node index.js sample-app
Creating a new React Native app in /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app.

Using package manager as npm with npm interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...

sample-app@0.1.0 /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app
└─┬ react-native-scripts@0.0.50
...
% node index.js sample-app --package-manager npm
Creating a new React Native app in /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app.

Using package manager as npm with npm interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...
...
% node index.js sample-app --package-manager test
Creating a new React Native app in /Users/metheglin/Documents/workspace-vagrant/rvprov-tenderloin/shared/create-react-native-app/create-react-native-app/build/sample-app.

Using package manager as test with npm interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...

test: --save-dev: unknown operand
`test install --save-dev --save-exact react-native-scripts` failed

@brentvatne brentvatne merged commit 1609cef into expo:master Jul 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants