yarn run passes command line arguments to the script that is executed

Created on 9 Sep 2017  路  7Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
bug

What is the current behavior?
After uprading to the latest yarn version (1.0.1), I receive an error message when running yarn with --scripts-prepend-node-path=auto:

>yarn run lint --scripts-prepend-node-path=auto
yarn run v1.0.1
$ tslint "./app/**/*.ts" --project tsconfig.json --type-check --exclude ./app/main-aot.ts "--scripts-prepend-node-path=auto"

  error: unknown option `--scripts-prepend-node-path=auto'

error Command failed with exit code 1.

If the current behavior is a bug, please provide the steps to reproduce.
Create a "dummy" package.json:

{
  "name": "dummy",
  "description": "A Dummy Application",
  "repository": "",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "lint": "echo"
  },
  "license": "ISC",
  "dependencies": {
  }
}

Run yarn run lint "--scripts-prepend-node-path=auto":
yarn run lint "--scripts-prepend-node-path=auto" yarn run v1.0.1 $ echo "--scripts-prepend-node-path=auto" "--scripts-prepend-node-path=auto"

What is the expected behavior?
I expect yarn run to behave the same way it did with version 0.28.4, i.e. it shouldn't pass any command line arguments (such as --scripts-prepend-node-path=auto) to the script that is executed (in my case tslint).

Please mention your node.js, yarn and operating system version.
nodejs: 8.4.0 x64
yarn: 1.0.1
os: windows 10 x64

Most helpful comment

@ste93cry there is a youtrack issue for that: https://youtrack.jetbrains.com/issue/WEB-28685

All 7 comments

I have the same problem with the same operating system, NodeJS and Yarn versions. I'm running the command from PHPStorm and the message is the same, so I don't think it's the cause of the problem

This is by design now: #4152.

This PR should have been marked as "Breaking:". Sorry for that.

You can change the order to get the old behavior: yarn run --scripts-prepend-node-path=auto lint

Or even yarn --scripts-prepend-node-path=auto lint

Unfortunately the full command is generated by PHPStorm, so maybe it's something that must be fixed by Jetbrains

@ste93cry there is a youtrack issue for that: https://youtrack.jetbrains.com/issue/WEB-28685

Thanks for the YouTrack reference! If this is causing a lot of issues, you may check in a pre-1.0 version of yarn into your repo and add a .yarnrc file with yarn-path ./yarn.js or something similar to force it to use the checked-in version of yarn.

Was this page helpful?
0 / 5 - 0 ratings