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 breaks the convention of npm-scripts and package.json #1189

Closed
dexteryy opened this issue Oct 18, 2016 · 2 comments
Closed

yarn breaks the convention of npm-scripts and package.json #1189

dexteryy opened this issue Oct 18, 2016 · 2 comments

Comments

@dexteryy
Copy link

dexteryy commented Oct 18, 2016

https://docs.npmjs.com/files/folders#executables

When in local mode, executables are linked into ./node_modules/.bin so that they can be made available to scripts run through npm. (For example, so that a test runner will be in the path when you run npm test.)

http://www.2ality.com/2016/01/locally-installed-npm-executables.html

https://docs.npmjs.com/cli/run-script

In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write:

"scripts": {"test": "tap test/\*.js"}

instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests.

But after I reinstalled all dependencies (application's package.json includes webcube, and webcube's package.json includes gulp and plop) with yarn, the node_modules/.bin/ is empty.

So for this package.json:

  "scripts": {
    "lint": "gulp --gulpfile node_modules/webcube/configs/gulpfile.babel.js check:all",
    "new": "plop --plopfile=node_modules/webcube/configs/plopfile.babel.js",

npm run lint, yarn run lint, npm run new and yarn run new fails if gulp and plop aren't installed in global mode

@bitfrost
Copy link

This looks like a duplicate of #760

@wyze
Copy link
Member

wyze commented Oct 24, 2016

Closing in favor of #760. Feel free to make a comment over there with this information @dexteryy.

@wyze wyze closed this as completed Oct 24, 2016
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

3 participants