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

Babel broken on Windows #7251

Closed
XhmikosR opened this issue May 6, 2020 · 5 comments · Fixed by #7286
Closed

Babel broken on Windows #7251

XhmikosR opened this issue May 6, 2020 · 5 comments · Fixed by #7286
Milestone

Comments

@XhmikosR
Copy link
Contributor

XhmikosR commented May 6, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.70.0/extended windows/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

yup

So, I tried to test drive the new Babel pipes addition :) On Windows I get the following error:

C:\Users\xmr\Desktop\bootstrap>ver

Microsoft Windows [Version 10.0.18363.815]

C:\Users\xmr\Desktop\bootstrap>node -v && npm -v
v12.16.3
6.14.4

C:\Users\xmr\Desktop\bootstrap>npm ls @babel/cli @babel/core
bootstrap@4.3.1 C:\Users\xmr\Desktop\bootstrap
+-- @babel/cli@7.8.4
+-- @babel/core@7.9.6
`-- stylelint@13.3.3
  `-- @stylelint/postcss-css-in-js@0.37.1
    `-- @babel/core@7.9.6  deduped


C:\Users\xmr\Desktop\bootstrap>npm run docs-serve
> bootstrap@4.3.1 docs-serve C:\Users\xmr\Desktop\bootstrap
> hugo server --port 9001 --disableFastRender

Building sites … Built in 1828 ms
Error: Error building site: BABEL: failed to transform "js/main.js" (application/javascript): fork/exec C:\Users\xmr\Desktop\bootstrap\node_modules\@babel\cli\bin\babel.js: %1 is not a valid Win32 application.
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! bootstrap@4.3.1 docs-serve: `hugo server --port 9001 --disableFastRender`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the bootstrap@4.3.1 docs-serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xmr\AppData\Roaming\npm-cache\_logs\2020-05-06T13_08_14_971Z-debug.log
@bep
Copy link
Member

bep commented May 6, 2020

How can something new be broken? :-)

I'll admit, I haven't tested this on Windows (but we do have a CI test that runs fine on every platform, including Windows), but it works fine on MacOS. Can you tell me if there are any executables inside C:\Users\xmr\Desktop\bootstrap\node_modules\@babel\cli\bin?

@bep bep added the Bug label May 6, 2020
@bep bep added this to the v0.70.1 milestone May 6, 2020
@XhmikosR
Copy link
Contributor Author

XhmikosR commented May 6, 2020

The file is there, but Windows doesn't support shebangs. Hence if you want to run that file you need to do node foo.js or node.exe foo.js.

C:\Users\xmr\Desktop\bootstrap\node_modules\@babel\cli\bin>node babel.js --version
7.8.4 (@babel/core 7.9.6)

My guess is that it's due to that. How are you calling postcss BTW? It should be the same way.

@XhmikosR
Copy link
Contributor Author

XhmikosR commented May 6, 2020

@bep Now that I think about it more, I believe if one has installed the 2 packages globally, they won't hit this issue, because npm adds executable files in PATH. If you want to access the local executable files, you should access them in ./node_modules/.bin/babel.

So this issue should be present only for local installations.

@bep
Copy link
Member

bep commented May 18, 2020

I think I see it now ... I based the Babel implementation on top of an old PR -- and that was based on an older PostCSS implementation. We have since fixed this for PostCSS. I will get these in line and test on Windows.

bep added a commit to bep/hugo that referenced this issue May 18, 2020
@bep bep closed this as completed in #7286 May 18, 2020
bep added a commit that referenced this issue May 18, 2020
@bep bep modified the milestones: v0.70.1, v0.71 May 18, 2020
muenchhausen pushed a commit to muenchhausen/hugo that referenced this issue Jun 24, 2020
muenchhausen pushed a commit to muenchhausen/hugo that referenced this issue Jun 24, 2020
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants