rspack icon indicating copy to clipboard operation
rspack copied to clipboard

Starter examples in CLI not working as expected in windows

Open asrvd opened this issue 1 year ago • 11 comments

System Info

System: OS: Windows 11 10.0.22621 CPU: (4) x64 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz Memory: 1.13 GB / 7.73 GB Binaries: Node: 18.18.2 - ~\scoop\apps\nvm\current\nodejs\nodejs\node.EXE npm: 9.8.1 - ~\scoop\apps\nvm\current\nodejs\nodejs\npm.CMD pnpm: 7.9.0 - ~\AppData\Local\pnpm\pnpm.EXE Browsers: Edge: Chromium (119.0.2151.72) Internet Explorer: 11.0.22621.1 npmPackages: @rspack/cli: 0.4.0 => 0.4.0 @rspack/core: 0.4.0 => 0.4.0 @rspack/plugin-react-refresh: 0.4.0 => 0.4.0

Details

I used the cmd given in the docs to create a new rspack project pnpm create rspack@latest, everything worked perfectly until I ran pnpm dev

Here's the error I got -

image

The error arises because you can't set env vars like that on widows, the correct syntax for windows will be - SET NODE_ENV=something

I changed the scripts in package.json to this and it worked as expected -

...
"scripts": {
    "dev": "SET NODE_ENV=development && rspack serve",
    "build": "SET NODE_ENV=production && rspack build"
  },
...

Is there any way we can check for the os info before copying the package.json and make changes accordingly? I'm willing to help on this issue :)

Reproduce link

No response

Reproduce Steps

  1. Run pnpm create rspack@latest
  2. Choose any starter
  3. Run pnpm dev

note: this is a windows specific issue

asrvd avatar Nov 28 '23 14:11 asrvd

we need to use cross-env to set environment, @asrvd can you give it a try

hardfist avatar Nov 28 '23 15:11 hardfist

sure, will update on this soon

asrvd avatar Nov 28 '23 15:11 asrvd

we need to use cross-env to set environment, @asrvd can you give it a try

worked perfectly! will make a pr soon

image

asrvd avatar Nov 28 '23 15:11 asrvd

thanks in advance

hardfist avatar Nov 28 '23 15:11 hardfist

thanks in advance

just finished making the changes, wanted to run package specific tests but there are no scripts for the package ?

image

asrvd avatar Nov 29 '23 04:11 asrvd

tried installing the deps so that I can run the cli manually, but getting this error again

image

asrvd avatar Nov 29 '23 05:11 asrvd

It's still broken, how about use cross-env in starter-templates scripts ? If you think it is useful, I can create a PR soon.

daydayhappychao avatar Dec 30 '23 15:12 daydayhappychao

It's still broken, how about use cross-env in starter-templates scripts ? If you think it is useful, I can create a PR soon.

thanks in advance

hardfist avatar Dec 30 '23 15:12 hardfist

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Feb 28 '24 15:02 stale[bot]

bump

xc2 avatar Feb 28 '24 18:02 xc2

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Apr 28 '24 19:04 stale[bot]