yarn run doesn't work, but npm run

Created on 20 Oct 2016  路  10Comments  路  Source: yarnpkg/yarn

  • Run successfully from Terminal: webpack --progress --colors --watch
  • Run successfully with npm run start
  • Got "command not found" with yarn run start

Webpack is installed globally.

My package.json like this:

"scripts": { "dist": "webpack -p", "lint": "eslint *.js", "start": "webpack --progress --colors --watch" }

I think it's a bug.

yarn v0.15.1, node 6.5.0, OSX 10.11.6

Most helpful comment

Thanks, I have the same problem then :)

it seems like the whole webpack --progress --colors --watch is considered as one binary to be called by sh and not webpack followed by parameters!

All 10 comments

@Tiendq which error is returned when calling yarn run start?

@victornoel Here you are

`YOSEMITE:react-todo-list tiendq$ yarn run start

yarn run v0.15.1

$ "webpack --progress --colors --watch"

sh: webpack --progress --colors --watch: command not found

error Command failed with exit code 127.

info Visit http://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Thanks, I have the same problem then :)

it seems like the whole webpack --progress --colors --watch is considered as one binary to be called by sh and not webpack followed by parameters!

@victornoel Agreed. That's odd, though, because _execute-lifecycle-script_ is adding the -c flag to the command from the package.json.

That flag shoud cause the shell to should correctly parse arguments found within the original command string, e.g.,:

$ sh "ls -a"
sh: ls -a: No such file or directory

_vs_

$ sh -c "ls -a"
.  ..  .idea gulpfile.js  node_modules  package.json  src  systemjs.config.js  tsconfig.json  tslint.json  yarn.lock

@Tiendq @victornoel Out of curiosity, what happens if you just yarn start, omitting run? (You don't need to add run or run-script to well-known script names in npm, and it seems yarn has preserved this.)

@michaelsanford The same error.

I think this is a duplicate of #733, and should be fixed via #809, which is included in 0.16.0.

I just updated yarn 0.16.1, and yarn run works well now. Thank you.

Just happened to me but I realized that I hadn't run 'yarn' after I added some new files from a co-worker. After I ran 'yarn', 'yarn start' fired right up!

I'm on 'yarn run v1.12.3' this version, help me to fix this issue
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Same issue in 1.22.4. Can execute it via npm but unable to do so with yarn.
yarn run v1.22.4 $ webpack --config webpack.config.dev.js --color --verbose --progress --watch /usr/bin/bash: /d: No such file or directory Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Webpack isnt installed globally however, tried to target the binary located in node_modules/.bin/webpack directly, but without any success.

Was this page helpful?
0 / 5 - 0 ratings