yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.39k stars 2.72k forks source link

`yarn run` fails to recognize a project command named `production` #2009

Closed greypants closed 7 years ago

greypants commented 7 years ago

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

What is the current behavior? yarn run ignores a project command named production

If the current behavior is a bug, please provide the steps to reproduce. Running yarn run production yields a No command specefied error, then proceeds to list Project commands, including the one specified

yarn run production
yarn run v0.17.8
error No command specified.
info Commands available from binary scripts: eslint, gulp-starter, gulp-starter-karma, svg2react, eslint, gulp-starter, gulp-starter-karma, svg2react
info Project commands
   - lint
   - preproduction
   - production
   - start
   - test
   - test:watch
question Which command would you like to run?:

What is the expected behavior? The production command listed in the scripts object in my pakage.json file should run. It seems to only ignore this specific word. If I rename the command to something like build, it runs fine.

Please mention your node.js, yarn and operating system version. Node v6.9.1, Yarn v0.17.8, OS X 10.10.5

wyze commented 7 years ago

Duplicate #1609.

ayushya commented 7 years ago

facing the exact same issue @wyze,

On node v7.4, Yarn0.18.1

FDiskas commented 7 years ago

Got the same error on bitbucket pipeline v0.24.6 package.json

"scripts": {
    "lint": "NODE_ENV=test eslint src/**"
},

Error:

+ yarn run lint
yarn run v0.24.6
error No command specified.
info Commands available from binary scripts: babel, babel-doctor, babel-external-helpers, babel-node, build-storybook, codeceptjs, eslint, jest, node-sass, nodemon, rimraf, serve, start-storybook, storybook-server, webpack, webpack-bundle-analyzer, webpack-dashboard, webpack-dev-server
info Project commands
   - lint
      NODE_ENV=test eslint src/**

And CI did't stop here. So again it's another issue. The yarn returned the wrong exit code. :clock930:

FDiskas commented 7 years ago

In my case there was a problem in .yarnrc file

.yarnrc

--emoji true

So I removed that