yarn run + npm scripts
This might be a duplicate of https://github.com/yarnpkg/yarn/issues/733 but I'm not sure.
In https://github.com/rust-lang/crates.io/pull/457, we're trying to move to yarn. It's an ember app, and so relies on things like ember test to run tests.
The important part of the diff is here: https://github.com/rust-lang/crates.io/pull/457/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R10
That is, we have several npm scripts that, in my understanding, should be prefixed with yarn run. But on Travis, and possibly in other configurations, this seems to fail.
Am I Doing it Wrong, or is this a bug?
Are you seeing an error message?
Also reported in https://github.com/yarnpkg/yarn/issues/782
@Daniel15
error Command failed with exit code 127
is what I get when I try yarn start.
Ah sorry, the rebase made Travis go away. If you look at the comments, @carols10cents shows an error.
On Oct 11, 2016, 22:36 -0400, Yojan Shrestha [email protected], wrote:
@Daniel15 (https://github.com/Daniel15)
error Command failed with exit code 127
is what I get when I try yarn start.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub (https://github.com/yarnpkg/yarn/issues/780#issuecomment-253103014), or mute the thread (https://github.com/notifications/unsubscribe-auth/AABsiqa0NJCciwUDKNGTnHNmmzx-kibJks5qzEeSgaJpZM4KUQ7o).
Taking a look at https://yarnpkg.com/en/docs/cli/run , the usage should be yarn run blah where blah is a key in the scripts object in package.json. I don't think you want your yarn runs in the script blocks unless they need to reference other script items.
Try changing yarn run ember test in .travis.yml to yarn run test and
change "test": "yarn run ember test" in package.json to "test": "ember test" and see if that gets you closer.
@FLGMwt that would make sense, thanks. I've pushed a commit, we'll see what travis says.
FWIW, I'm experiencing the same issue as @steveklabnik in the same context (i.e. ember commands).
For example, I have scripts in my package.json like this:
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:each",
"test:dev": "ember test --filter ESLint -i",
"tdd": "npm run test:dev -- -s",
"lint": "ember test --filter ESLint"
},
npm run test will run the script located at the test key in the scripts object (i.e. ember try:each).
yarn run test does the following:

So it seems that there's a disconnect where yarn run might not be correctly accessing the .bin folder in node_modules?
FWIW, yarn run ember try:each DOES work, so it seems the issue is scoped to actually calling .bin commands from the scripts hash.
Seeing an similar issue. If the script in package.json is a single command it will run. If the command has arguments or is a compound command (or contains a space), the script fails with exit code 127.
This should be fixed in #809
@randycoulman looks like it.
What's yarn's release schedule gonna look like? Any idea when that'll hit a release?
Any eta on releasing this?
@scothis same problem here:
"scripts": {
"start": "node server.js",
"test": "mocha"
},
yarn
$ yarn start
yarn start v0.15.1
$ "node server.js"
sh: node server.js: command not found
error Command failed with exit code 127.
info Visit http://yarnpkg.com/en/docs/cli/start for documentation about this command.
npm
$ npm start
> [email protected] start /path/to/project
> node server.js
npm runs fine, but yarn errors out. I tried yarn run start as well and got the same results. If I remove server.js from the start script, the node repl starts up just fine.
As stated #809 will resolve this.
Thanks everyone!
Gracias @dougludlow
I am experiencing similar issue in Yarn version 0.17.8.
Basically, I cannot reference yarn run inside of one of my scripts, I have to use npm run...
This works! Referencing npm run inside of the build script
package.json
--------------
"scripts": {
"gulp": "gulp",
"bower": "gulp bower",
"build": "npm run bower && npm run gulp"
}
CLI
--------------
$ yarn build
But this does not work, referencing yarn run inside of build script...
package.json
--------------
"scripts": {
"gulp": "gulp",
"bower": "gulp bower",
"build": "yarn run bower && yarn run gulp"
}
CLI
--------------
$ yarn build
Output...
➥ yarn run build
yarn run v0.17.8
$ yarn run bower && yarn run gulp
/www/node_modules/yarn/bin/yarn.js:62
throw err;
^
Error: ENOENT: no such file or directory, open '/www/node_modules/proper-lockfile/node_modules/extend/index.js'
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.Module._extensions..js (module.js:421:20)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/www/node_modules/proper-lockfile/index.js:5:14)
at Module._compile (module.js:413:34)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I am not sure if this issue was re-introduced at some point after #809 or if this is an entirely different issue.
- I am running macOS Sierra 10.12.1
- All dependencies are installed locally minus Yarn (so, either
npm run gulporyarn run gulpis necessary to execute)
If you are aware of an existing issue already addressing this please point me in that direction. I have found several very similar issues but they don't quite address the same problem.
Has this been resolved? Im using buble (https://buble.surge.sh) trying to output code into a .js file like so;
yarn buble input.js > output.js
I get the annoying (unnecessary) gibberish in my file.
yarn buble v0.17.8
$ node ./node_modules/.bin/buble demo.js
var name = function () { return 'Sabelo'; };
Done in 0.63s.
@ElvisMagagula - That looks like a separate issue, could you please file a separate GitHub issue for it?
@kstoddar currently in the same position
Can anyone please help me with some information related to following.
events.js:182 throw er; // Unhandled 'error' event ^
Error: watch /home/pavan/ALPS/web-alps/public ENOSPC
at exports._errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1384:19)
at Object.fs.watch (fs.js:1410:11)
at createFsWatchInstance (/home/pavan/ALPS/web-alps/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/pavan/ALPS/web-alps/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/pavan/ALPS/web-alps/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/pavan/ALPS/web-alps/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.
This error sometimes it appear and sometimes it doesn`t.
Thanks, Pavan.
@pavankumarbijja this is a question for StackOverflow or Google. Google ENOSPC and you'll get your answer ;)