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

Bundle targets fail when path contains spaces #7597

Closed
prupipho opened this issue Apr 15, 2021 · 6 comments · Fixed by #7677 or #8625
Closed

Bundle targets fail when path contains spaces #7597

prupipho opened this issue Apr 15, 2021 · 6 comments · Fixed by #7677 or #8625

Comments

@prupipho
Copy link

It´s not a big issue when you know what´s happening as you can avoid it. But it would be nice if it works.
Similar to this old issue

Environment

Run the following in your terminal and copy the results here.

  1. npx react-native --version: 5.0.1-alpha.2
  2. npx react-native info:
System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 2.10 GB / 15.76 GB
  Binaries:
    Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0
  IDEs:
    Android Studio: Version  4.1.0.0 AI-201.8743.12.41.7042882
    Visual Studio: 16.8.31019.35 (Visual Studio Community 2019)
  Languages:
    Java: 1.8.0_211 - C:\Program Files\Java\jdk1.8.0_211\bin\javac.EXE        
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.64.0 => 0.64.0
    react-native-windows: ^0.64.0-0 => 0.64.3
  npmGlobalPackages:
    *react-native*: Not Found
  • Target Platform Version(s): 10.0.18362.0
  • Target Device(s): Desktop
  • Visual Studio Version: Microsoft Visual Studio Community 2019
  • Build Configuration: Release

Steps To Reproduce

  1. Create a folder that contain spaces on its name. For example: C:/Code/React Native
  2. Create new app using latest version and typescript running:
    npx react-native init MyTSApp --template react-native-template-typescript cd MyTSApp
  3. Move to folder with cd MyTsApp and run npx react-native-windows-init --overwrite --language cs
  4. Install dependencies running yarn
  5. Try creating an App Package. Right-click project > Publish > Create App Packages
    • create new certificate an choose Release

Expected Results

It should create the App Package but it fails.

Snack, code example, screenshot, or link to a repository:

Error:

  • Error: EEXIST: file already exists, mkdir 'C:\Code\React'
  • The command "npx --no-install react-native bundle --platform windows --entry-file index.js --bundle-output C:\Code\React Native\samplepp\windows\samplepp\Bundle\index.windows.bundle --assets-dest C:\Code\React Native\samplepp\windows\samplepp\Bundle --dev false --reset-cache --sourcemap-output C:\Code\React Native\samplepp\windows\samplepp\bin\x86\Release\sourcemaps\react\index.windows.bundle.map " exited with code 1. samplepp
  • Note: It created a file with the first block of the text of the folder "React Native" -> " React", at the same level of that folder: C: in our sample. content of the file starts with:
{"version":3,"sources":["__prelude__","C:\\code\\React Native....

image

Error when trying to create de package

image

@prupipho prupipho added the bug label Apr 15, 2021
@ghost ghost added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Apr 15, 2021
@NickGerleman
Copy link
Collaborator

Seems like we need some extra quotes around input with possible spaces in our MSBuild targets running bundle commands.

@NickGerleman NickGerleman changed the title Spaces in the project path cause publish windows app to fail Bundle targets fail when path contains spaces Apr 15, 2021
@chrisglein chrisglein added Area: Bundle good first issue Partner: Microsoft and removed Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) labels Apr 15, 2021
@chrisglein chrisglein added this to the 0.65 milestone Apr 15, 2021
@sibille
Copy link

sibille commented Apr 20, 2021

Thanks for looking into this, is there a possibility to back-port this to 0.64?

@chrisglein chrisglein modified the milestones: 0.65, 0.66 Apr 24, 2021
NickGerleman added a commit to NickGerleman/react-native-windows that referenced this issue Apr 28, 2021
Fixes microsoft#7597

We're passing raw strings into the exec string for running commands from MSBuild. Paths with spaces will be interpreted as multiple CLI args. Wrap paths in quotes to fix paths with spaces.
NickGerleman added a commit to NickGerleman/react-native-windows that referenced this issue Apr 28, 2021
Fixes microsoft#7597

We're passing raw strings into the exec string for running commands from MSBuild. Paths with spaces will be interpreted as multiple CLI args. Wrap paths in quotes to fix paths with spaces.
@ghost ghost closed this as completed in #7677 Apr 28, 2021
ghost pushed a commit that referenced this issue Apr 28, 2021
* Fix MSBuild Bundling When Path Contains Spaces

Fixes #7597

We're passing raw strings into the exec string for running commands from MSBuild. Paths with spaces will be interpreted as multiple CLI args. Wrap paths in quotes to fix paths with spaces.

* Change files
NickGerleman added a commit that referenced this issue May 20, 2021
* Fix MSBuild Bundling When Path Contains Spaces

Fixes #7597

We're passing raw strings into the exec string for running commands from MSBuild. Paths with spaces will be interpreted as multiple CLI args. Wrap paths in quotes to fix paths with spaces.

* Change files

Co-authored-by: Andrew Coates <[email protected]>
@eastcoastcoder
Copy link

Please reopen, this is still not working as of RN 0.65
#7678 (comment)

@ghost ghost added the Needs: Attention 👋 An issue that had been tagged "Needs: Author Feedback" has received activity (label applied by bot) label Sep 12, 2021
@NickGerleman NickGerleman reopened this Sep 12, 2021
@NickGerleman NickGerleman added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Sep 12, 2021
@NickGerleman
Copy link
Collaborator

New regression in 0.65. Issue is in the dependencies script, according to the screenshot. cc @asklar

@chrisglein chrisglein removed good first issue Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) Needs: Attention 👋 An issue that had been tagged "Needs: Author Feedback" has received activity (label applied by bot) Request Backport to 0.64 labels Sep 13, 2021
@chrisglein
Copy link
Member

Worth adding a regression test that has a space so we catch issues like this earlier.

@asklar
Copy link
Member

asklar commented Sep 14, 2021

The bug is not in the dependencies script (the error is that the dependencies script cannot be run). The bug is in the doctor/healthcheck code:

https://github.com/microsoft/react-native-windows/blob/main/packages/%40react-native-windows/cli/src/healthChecks.ts#L18-L22

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment