eleventy-react icon indicating copy to clipboard operation
eleventy-react copied to clipboard

npm run dev doesn't work? (Windows)

Open kuworking opened this issue 5 years ago • 9 comments

Trying to clone and run the repo in a Windows environment, and changing the scripts with cross-env (yarn add -D cross-env)

    "dev": "cross-env ELEVENTY_EXPERIMENTAL=true eleventy --serve",
    "build": "cross-env ELEVENTY_EXPERIMENTAL=true eleventy",

Then with npm run dev it just doesn't work, no error messages, simply the terminal ends the process instead of being alive

PS C:\...\eleventy-react> npm run dev

> [email protected] dev C:\...\eleventy-react
> cross-env ELEVENTY_EXPERIMENTAL=true eleventy --serve

Warning: Configuration API `addExtension` is an experimental Eleventy feature with an unstable API. Be careful!
PS C:\...\eleventy-react> 

EDIT: Also build doesn't seem to do anything

kuworking avatar Nov 14 '20 11:11 kuworking

Hi @kuworking have you tried using env ELEVENTY_EXPERIMENTAL=true npx eleventy --serve ?

signalkuppe avatar Nov 14 '20 18:11 signalkuppe

'env' is not recognized as an internal or external command,

If I try

"set ELEVENTY_EXPERIMENTAL=true && npx eleventy --serve"
(or)
"set ELEVENTY_EXPERIMENTAL=true & npx eleventy --serve"

Then the same outcome, exiting without any error message

kuworking avatar Nov 14 '20 18:11 kuworking

I have managed to install Ubuntu with Windows-WSL2, and there I've cloned and run your repo and it works as expected

I doubt it has anything to do with your code, but with 11ty (and likely the ELEVENTY_EXPERIMENTAL feature)

OOT: So in this repo you're using React and Styled-Components that are compiled into plain html, vanilla js and vanilla css without any react runntime or similar, right?

kuworking avatar Nov 14 '20 20:11 kuworking

I have managed to install Ubuntu with Windows-WSL2, and there I've cloned and run your repo and it works as expected

I doubt it has anything to do with your code, but with 11ty (and likely the ELEVENTY_EXPERIMENTAL feature)

Ok, thanks for finding this.

OOT: So in this repo you're using React and Styled-Components that are compiled into plain html, vanilla js and vanilla css without any react runntime or similar, right?

Yeah, the output it's just plain html and css, client-side js is up to you.

signalkuppe avatar Nov 14 '20 22:11 signalkuppe

It's awesome, I just wanted to say thanks for the repo :)

Feel free to close the issue, or I can close it when the 11ty one is fixed

kuworking avatar Nov 14 '20 22:11 kuworking

@kuworking You can install cross-env and modify your dev script to this: "dev": "cross-env NODE_ENV=dev npm-run-all clean build:ts -p watch:* -- --watch",

I switch a lot between windows, linux and osx, and this is very useful for this kind of cases ;)

dvelasquez avatar Feb 13 '21 16:02 dvelasquez

@kuworking You can install cross-env and modify your dev script to this: "dev": "cross-env NODE_ENV=dev npm-run-all clean build:ts -p watch:* -- --watch",

I switch a lot between windows, linux and osx, and this is very useful for this kind of cases ;)

I tried with cross-env without success, but if in your hands it works then I'm very interested

If possible, could you provide a script that works with this repo? in the sense that here there's no build:ts or watch

If I run a stripped down version "dev": "cross-env NODE_ENV=dev npm-run-all build -p", it again exists without any error message

kuworking avatar Feb 26 '21 19:02 kuworking

in react/findSources.js (line 6) there might by some path issues when using path.join method in Windows (the determined path has backslashes causing the fastglob function to return an empty array).

You could try replacing

let globPath = path.join(dir, '**/*.jsx');

with

let globPath = path.posix.join(dir, '**/*.jsx');

striberny avatar Apr 16 '21 08:04 striberny

in react/findSources.js (line 6) there might by some path issues when using path.join method in Windows (the determined path has backslashes causing the fastglob function to return an empty array).

You could try replacing

let globPath = path.join(dir, '**/*.jsx');

with

let globPath = path.posix.join(dir, '**/*.jsx');

I need to find some time to go deeper here (some errors here and there), but just using this posix line seems to me that this actually does the trick (!)

I'd say I can now run the code in Windows as in WSL (I'll confirm as soon as I can), thanks!

kuworking avatar Apr 26 '21 19:04 kuworking