Yarn: npm run command can't find file?

Created on 12 Oct 2016  路  7Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
bug

What is the current behavior?

yarn run start
yarn run v0.15.1
$ "$(npm bin)/babel-node scripts/start.js"
sh: /Users/...path.../node_modules/.bin/babel-node scripts/start.js: No such file or directory
error Command failed with exit code 127.

If the current behavior is a bug, please provide the steps to reproduce.

"scripts": {
"start" : "$(npm bin)/babel-node scripts/start.js"
}

What is the expected behavior?
The script should be _found_ since it exists. npm run start handles this as expected.

Please mention your node.js, yarn and operating system version.
Node - v6.7.0
yarn - v0.15.1
OS - osx 10.10.5

Most helpful comment

I confirm as well. A direct port of npm to yarn breaks:

"scripts": {
    "dev": "webpack-dev-server --progress --colors --port 9090"
}

yarn run dev errors with:

No such file or directory
error Command failed with exit code 127.

Node: 6.5.0
Yarn: 0.15.1
OS: macOS 10.12

All 7 comments

I think you'll be fine without the $(npm bin)/ and just "start": "babel-node scripts/start.js" since yarn run includes the .bin of the working project (https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/run.js#L35)

Additionally, the idea is to use the npm cli _or_ yarn as they're serving the same purpose : )

@FLGMwt I get the same error after removing bin. Also can't fathom why removing bin would change anything since it is inside $()

I confirm as well. A direct port of npm to yarn breaks:

"scripts": {
    "dev": "webpack-dev-server --progress --colors --port 9090"
}

yarn run dev errors with:

No such file or directory
error Command failed with exit code 127.

Node: 6.5.0
Yarn: 0.15.1
OS: macOS 10.12

See https://github.com/yarnpkg/yarn/issues/733. I think this is the same problem.

"start": "pwd" works. But "start": "echo 'stuff'" fails. This validates https://github.com/yarnpkg/yarn/issues/733#issuecomment-253086168

This is fixed in current master branch (see #809)

Fixed via #809.

Was this page helpful?
0 / 5 - 0 ratings