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

SyntaxError: Invalid Unicode escape sequence #18824

Closed
1 of 4 tasks
MiiZZo opened this issue Aug 24, 2023 · 3 comments · Fixed by #27136
Closed
1 of 4 tasks

SyntaxError: Invalid Unicode escape sequence #18824

MiiZZo opened this issue Aug 24, 2023 · 3 comments · Fixed by #27136
Assignees
Labels
outdated scope: react Issues related to React support for Nx type: bug

Comments

@MiiZZo
Copy link

MiiZZo commented Aug 24, 2023

Current Behavior

Get this error when run pnpm nx run web:serve --prod
C:\Users\user\Documents\projects\app\dist\packages\web.nx-helpers\with-nx.js:19
workspaceRoot: 'C:\Users\user\Documents\projects\app',
^^^^^^

There are no errors if I replace all \ with / manually in workspaceRoot.

Expected Behavior

No errors

GitHub Repo

https://github.com/MiiZZo/rsc-posts-app

Steps to Reproduce

  1. Copy repo
  2. run nx run web:serve --prod

Nx Report

-

Failure Logs

No response

Package Manager Version

[email protected] or [email protected]

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@FrozenPandaz FrozenPandaz added the scope: react Issues related to React support for Nx label Aug 24, 2023
@AlexWind96
Copy link

I have the same issue. @MiiZZo Did you find a solution to fix this?

Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Apr 26, 2024
@github-actions github-actions bot removed the stale label May 16, 2024
jaysoo added a commit that referenced this issue Jul 26, 2024
This PR fixes an issue where our `withNx` function for Next.js is
compiled with inlined `workspaceRoot` (to support container
environments). On Windows, we write the `.nx-helpers/with-nx.js` with
the following:

```js
workspaceRoot: 'C:\Users\user\projects\app',
```

The `\u` character result in a Node error: `Invalid Unicode escape
sequence`.

The fix is to escape `\` as `\\`, so when the file is written, the path
is valid and does not cause unicode errors.

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #18824
FrozenPandaz pushed a commit that referenced this issue Jul 30, 2024
This PR fixes an issue where our `withNx` function for Next.js is
compiled with inlined `workspaceRoot` (to support container
environments). On Windows, we write the `.nx-helpers/with-nx.js` with
the following:

```js
workspaceRoot: 'C:\Users\user\projects\app',
```

The `\u` character result in a Node error: `Invalid Unicode escape
sequence`.

The fix is to escape `\` as `\\`, so when the file is written, the path
is valid and does not cause unicode errors.

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #18824

(cherry picked from commit 4ab9e6d)
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants