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

yarn run doesn't work, but npm run #1298

Closed
tiendq opened this issue Oct 20, 2016 · 10 comments
Closed

yarn run doesn't work, but npm run #1298

tiendq opened this issue Oct 20, 2016 · 10 comments

Comments

@tiendq
Copy link

tiendq commented Oct 20, 2016

  • 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

@victornoel
Copy link
Contributor

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

@tiendq
Copy link
Author

tiendq commented Oct 20, 2016

@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.`

@victornoel
Copy link
Contributor

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!

@michaelsanford
Copy link

michaelsanford commented Oct 20, 2016

@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.)

@tiendq
Copy link
Author

tiendq commented Oct 20, 2016

@michaelsanford The same error.

@calvinl
Copy link

calvinl commented Oct 20, 2016

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

@tiendq
Copy link
Author

tiendq commented Oct 21, 2016

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

@tiendq tiendq closed this as completed Oct 21, 2016
@bradleyfindeis
Copy link

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!

@bilalmajeed64
Copy link

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.

@carlkentor
Copy link

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 �[1mhttps://yarnpkg.com/en/docs/cli/run�[22m 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.

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

7 participants