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

Cannot run gatsby-dev in PowerShell #14609

Closed
YoshiWalsh opened this issue Jun 7, 2019 · 1 comment
Closed

Cannot run gatsby-dev in PowerShell #14609

YoshiWalsh opened this issue Jun 7, 2019 · 1 comment

Comments

@YoshiWalsh
Copy link
Contributor

Description

Running gatsby-dev works fine in CMD, but not in PowerShell.

Steps to reproduce

I have followed these instructions up until where it says to run gatsby-dev.

Expected result

gatsby-dev should run.

Actual result

PS D:\git\personal-blog> gatsby-dev
At C:\Users\josh\AppData\Local\Yarn\bin\gatsby-dev.ps1:5 char:13
+     *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+             ~
Unexpected token ')' in expression or statement.
At C:\Users\josh\AppData\Local\Yarn\bin\gatsby-dev.ps1:8 char:3
+ if [ -x "$basedir/pwsh" ]; then
+   ~
Missing '(' after 'if' in if statement.
At C:\Users\josh\AppData\Local\Yarn\bin\gatsby-dev.ps1:8 char:5
+ if [ -x "$basedir/pwsh" ]; then
+     ~
Missing type name after '['.
At C:\Users\josh\AppData\Local\Yarn\bin\gatsby-dev.ps1:9 char:20
+ ... edir/pwsh"  "$basedir/../Data/global/node_modules/.bin/gatsby-dev.ps1 ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"$basedir/../Data/global/node_modules/.bin/gatsby-dev.ps1"' in expression or statement.
At C:\Users\josh\AppData\Local\Yarn\bin\gatsby-dev.ps1:9 char:79
+ ... wsh"  "$basedir/../Data/global/node_modules/.bin/gatsby-dev.ps1" "$@"
+                                                                      ~~~~
Unexpected token '"$@"' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken

Environment

PS D:\git\personal-blog> gatsby info --clipboard

  System:
    OS: Windows 10
    CPU: (16) x64 AMD Ryzen 7 1800X Eight-Core Processor
  Binaries:
    Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.5.0-next.0 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.15
  Browsers:
    Edge: 44.17763.1.0
  npmPackages:
    gatsby: ^2.8.2 => 2.8.2
    gatsby-image: ^2.0.22 => 2.0.25
    gatsby-plugin-canonical-urls: ^2.0.8 => 2.0.8
    gatsby-plugin-catch-links: ^2.0.9 => 2.0.9
    gatsby-plugin-excerpts: ^1.0.2 => 1.0.2
    gatsby-plugin-favicon: ^3.1.5 => 3.1.5
    gatsby-plugin-feed: ^2.0.8 => 2.0.11
    gatsby-plugin-google-analytics: ^2.0.5 => 2.0.8
    gatsby-plugin-manifest: ^2.0.5 => 2.0.12
    gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
    gatsby-plugin-offline: ^2.0.5 => 2.0.20
    gatsby-plugin-prefetch-google-fonts: ^1.1.1 => 1.1.1
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.5
    gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
    gatsby-plugin-root-import: ^2.0.4 => 2.0.4
    gatsby-plugin-s3: ^0.2.5 => 0.2.5
    gatsby-plugin-sass: ^2.0.7 => 2.0.7
    gatsby-plugin-sharp: ^2.1.3 => 2.1.3
    gatsby-plugin-sitemap: ^2.0.4 => 2.0.4
    gatsby-plugin-typography: ^2.2.0 => 2.2.3
    gatsby-redirect-from: ^0.1.1 => 0.1.1
    gatsby-remark-autolink-headers: ^2.0.12 => 2.0.12
    gatsby-remark-behead: 0.0.3 => 0.0.3
    gatsby-remark-copy-linked-files: ^2.0.5 => 2.0.8
    gatsby-remark-custom-blocks: ^2.0.3 => 2.0.3
    gatsby-remark-embed-youtube: 0.0.7 => 0.0.7
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-remark-images: ^3.0.0 => 3.0.12
    gatsby-remark-katex: ^3.0.1 => 3.0.1
    gatsby-remark-prismjs: ^3.0.0 => 3.1.4
    gatsby-remark-responsive-iframe: ^2.0.5 => 2.0.8
    gatsby-remark-smartypants: ^2.0.5 => 2.0.7
    gatsby-source-filesystem: ^2.0.27 => 2.0.27
    gatsby-transformer-remark: ^2.1.6 => 2.1.17
    gatsby-transformer-sharp: ^2.1.3 => 2.1.9

Extra information

Looking inside the file in question (C:\Users\josh\AppData\Local\Yarn\bin\gatsby-dev.ps1) it does not appear to be a valid PowerShell script, instead it's an sh script:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/pwsh" ]; then
  "$basedir/pwsh"  "$basedir/../Data/global/node_modules/.bin/gatsby-dev.ps1" "$@"
  ret=$?
else 
  pwsh  "$basedir/../Data/global/node_modules/.bin/gatsby-dev.ps1" "$@"
  ret=$?
fi
exit $ret
@DSchau
Copy link
Contributor

DSchau commented Jun 7, 2019

Hmm -- so this is super strange. I don't think that we created that gatsby-dev.ps1 script--it seems that it may be something that Yarn creates.

It appears that this is related to yarnpkg/yarn#6902 and was fixed in [email protected]. Could you update your version of yarn and see if that works?

Going to close as answered, but please let us know if this doesn't work and we can help further! Thanks!

@DSchau DSchau closed this as completed Jun 7, 2019
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

No branches or pull requests

2 participants