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

init with local react-native fails with EISDIR #186

Closed
fson opened this issue Feb 21, 2019 · 5 comments
Closed

init with local react-native fails with EISDIR #186

fson opened this issue Feb 21, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@fson
Copy link
Contributor

fson commented Feb 21, 2019

Environment

Using fson/react-native@8048dc7 and @react-native-community/cli@1.2.4.


  React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: x64 Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz
      Memory: 814.21 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 11.9.0 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.8.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react-native: /Users/ville/Projects/react-native => 1000.0.0 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Description

I was trying to test facebook/react-native#23563 end-to-end, so I ran react-native init HelloWorld --version <path-to-local-react-native-folder>. This failed with Error: EISDIR: illegal operation on a directory, read.

Output:

% react-native init HelloWorld --version /Users/ville/Projects/react-native
This will walk you through creating a new React Native project in /Users/ville/Projects/HelloWorld
Using yarn v1.13.0
Installing /Users/ville/Projects/react-native...
yarn add v1.13.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
...
✨  Done in 59.92s.
Setting up new React Native app in /Users/ville/Projects/HelloWorld
/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/graceful-fs/polyfills.js:144
        throw er
        ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:515:3)
    at Object.readSync (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/graceful-fs/polyfills.js:138:28)
    at tryReadSync (fs.js:338:20)
    at Object.readFileSync (fs.js:375:19)
    at copyAndReplace (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/util/copyAndReplace.js:77:22)
    at walk.forEach.absoluteSrcFilePath (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/generator/copyProjectTemplateAndReplace.js:94:5)
    at Array.forEach (<anonymous>)
    at copyProjectTemplateAndReplace (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/generator/copyProjectTemplateAndReplace.js:49:17)
    at createProjectFromTemplate (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/generator/templates.js:31:3)
    at generateProject (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/init/init.js:83:3)

Reproducible Demo

This is also reproducible in current master of facebook/react-native:

cd react-native
git checkout f32dc635467a2e93371f0cf2e40b07a712349288
yarn
cd ..
react-native init HelloWorld --version $PWD/react-native
@fson fson added the bug Something isn't working label Feb 21, 2019
@thymikee
Copy link
Member

cc @Esemesek who's working on new version of init

@Esemesek
Copy link
Member

I am working on it. Right now, I don't think --version works like that - you can only pass custom rn versions. To have a custom version of react-native, I use verdaccio to publish new version of react-native to local npm proxy. I wrote about this here.

@fson
Copy link
Contributor Author

fson commented Feb 21, 2019

--version supports file paths, it's explicitly documented in the code. I think we should make sure that keeps working, so it's easier to make changes to the template and debug them.

I avoided using Verdaccio on purpose, because publishing to a local npm after every edit is a bit of a pain and doesn't result in a pleasant edit-compile-debug cycle.

@Esemesek
Copy link
Member

I tried this briefly while moving codebase to separate repository and it seemed like it doesn't work. I agree that this is a painful flow to work with init.

@grabbou
Copy link
Member

grabbou commented Feb 26, 2019

I think we should make sure it's still possible to init a project by setting path to a React Native version. In the future, given the new init workflow, the --version will not be needed at all since CLI will pick React Native files directly from node_modules.

@fson, make sure to run npm pack and pass a path to a tgz file instead to a folder.

Should be:

$ react-native init HelloWorld --version /Users/ville/Projects/react-native/path-to-packed-files.tgz

Since you are testing iOS only - there's no extra work you need to do. In order to be able to have Android sources up to date, you would have to build ReactAndroid too.

See releases script for the exact set of commands to run here and here

@grabbou grabbou closed this as completed Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants