mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.52k stars 32.19k forks source link

[codemod] SyntaxError: missing ) after argument list #27320

Closed ct-amit closed 3 years ago

ct-amit commented 3 years ago

Current Behavior 😯

While running codemod command, it failed by following error:

PS E:\src> npx @material-ui/codemod@next v5.0.0/avatar-circle-circular src\views\
npx: installed 251 in 20.69s
Executing command: jscodeshift C:\Users\PC\AppData\Roaming\npm-cache\_npx\4648\node_modules\@material-ui\codemod\node_modules\.bin\jscodeshift --transform C:\Users\Amit-PC\AppData\Roaming\npm-cache\_npx\4648\node_modules\@material-ui\codemod\node\v5.0.0\avatar-circle-circular.js --extensions js,ts,jsx,tsx --parser tsx E:\src\src\views
C:\Users\PC\AppData\Roaming\npm-cache\_npx\4648\node_modules\@material-ui\codemod\node_modules\.bin\jscodeshift:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

Expected Behavior 🤔

It should not fail on command.

Steps to Reproduce 🕹

Steps:

  1. Open powershell and Goto root dir of project
  2. Run command: npx @material-ui/codemod@next v5.0.0/badge-overlap-value src\views/

Context 🔦

Your Environment 🌎

`npx @material-ui/envinfo` ``` System: OS: Windows 10 10.0.19042 Binaries: Node: 14.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.67) npmPackages: @emotion/react: ^11.4.0 => 11.4.0 @emotion/styled: ^11.3.0 => 11.3.0 @material-ui/codemod: ^5.0.0-beta.0 => 5.0.0-beta.0 @material-ui/core: ^5.0.0-beta.1 => 5.0.0-beta.1 @material-ui/data-grid: ^4.0.0-alpha.33 => 4.0.0-alpha.33 @material-ui/icons: ^5.0.0-beta.1 => 5.0.0-beta.1 @material-ui/lab: ^5.0.0-alpha.40 => 5.0.0-alpha.40 @material-ui/private-theming: 5.0.0-beta.1 @material-ui/styled-engine: 5.0.0-beta.1 @material-ui/styles: ^5.0.0-beta.1 => 5.0.0-beta.1 @material-ui/system: 5.0.0-beta.1 @material-ui/types: 6.0.1 @material-ui/unstyled: 5.0.0-alpha.40 @material-ui/utils: ^5.0.0-beta.0 => 5.0.0-beta.0 @types/react: ^17.0.11 => 17.0.14 react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 typescript: ^4.3.0 => 4.3.5 ```
ali-garajian commented 3 years ago

I'm having the exact same issue

eps1lon commented 3 years ago

I think you need to use a bash-like shell. Does the command work when using the git bash?

ali-garajian commented 3 years ago

@eps1lon I've only tested with git bash, and it doesn't work

siriwatknp commented 3 years ago

@michaldudak I am pretty lost on this issue, do you have any idea what cause the error?

michaldudak commented 3 years ago

On Windows, jscodeshift comes in bash and pwsh versions. On a mac, it's a js file. Running a bash script with node results in the error you see. I'm going to fix it or find a workaround now.

The root cause seems to be how Lerna handles workspace dependencies with .bin folder. Instead of creating a symlink, it created scripts that call the binary in root's dependencies.

michaldudak commented 3 years ago

By the way

I think you need to use a bash-like shell

It works fine with Powershell as well.

oliviertassinari commented 3 years ago

@Amit-PhoenixCoded @ali-garajian Could you try the fix that we did in #27395? You can use:

npx https://pkg.csb.dev/mui-org/material-ui/commit/172dbf44/@material-ui/codemod v5.0.0/xxx SRC_DIR

until we release the update.

ali-garajian commented 3 years ago

@oliviertassinari Yup, it worked! I no longer have this issue. Thanks a lot!