Skip to content

Conversation

@jan-zajic
Copy link
Contributor

Fix electron:dev npm task to run also on Windows OS.

@mb21
Copy link
Owner

mb21 commented Jul 16, 2021

Thanks, I quickly tried this on macOS and got:

yarn run v1.22.10
$ concurrently " set BROWSER=none && yarn start" "wait-on http://localhost:3000 && yarn run electron:tsc -w" "wait-on http://localhost:3000 && yarn run electron:tsc -p electron && set ELECTRON_IS_DEV=1 && electron .
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
error Command failed with exit code 2.

@jan-zajic
Copy link
Contributor Author

Thank you, sorry for little mistake.. '"' lost somehow during merging/rebasing.. Can you please try it again?

@mb21
Copy link
Owner

mb21 commented Jul 16, 2021

While it runs now, the env variables aren't set. I don't think there's a syntax that works on both unix and windows... so probably best to add a new command electron:dev:windows or something?

@mb21 mb21 force-pushed the master branch 2 times, most recently from d800848 to 7b1255a Compare July 14, 2024 08:19
ExactDoug pushed a commit to ExactDoug/panwriter that referenced this pull request Nov 28, 2025
The current npm scripts use Unix-specific syntax that fails on Windows:
- Environment variables use Unix syntax (VAR=value) instead of cross-platform
- The postinstall script uses Unix 'cp' command which doesn't exist on Windows
- Windows developers cannot run npm scripts natively without WSL

This change adds proper cross-platform support:

1. Added 'cross-env' dependency (v7.0.3)
   - Handles environment variable setting across all platforms
   - Used in: build, electron:dev, website:build scripts

2. Added 'shx' dependency (v0.3.4)
   - Provides Unix commands (like cp) on all platforms
   - Used in: postinstall script

These are industry-standard packages for Node.js cross-platform compatibility.

Scripts updated:
- build: Added cross-env for INLINE_RUNTIME_CHUNK
- postinstall: Changed cp to shx cp for cross-platform file copying
- electron:dev: Added cross-env for BROWSER and ELECTRON_IS_DEV
- website:build: Added cross-env for BUILD_PATH, PUBLIC_URL, INLINE_RUNTIME_CHUNK

This fixes the issues reported in PR mb21#65 and allows Windows developers to run
all npm scripts without modification.
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.

2 participants