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

Fallback to yarn when npm isn't installed #8787

Closed
dandv opened this issue Jun 23, 2017 · 6 comments
Closed

Fallback to yarn when npm isn't installed #8787

dandv opened this issue Jun 23, 2017 · 6 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion

Comments

@dandv
Copy link
Contributor

dandv commented Jun 23, 2017

  • ESLint Version:
    4.0.0
  • Node Version:
    v7.10.0
  • npm Version:
    None! Due to some issues with npm, I'm testing a yarn-only development flow.

What did you do? Please include the actual source code causing the issue.

yarn add --dev eslint
./node_modules/.bin/eslint --init

What did you expect to happen?
It would be great if eslint didn't rely on npm to be installed, and ran yarn if npm was not found.

What actually happened? Please include the actual, raw output from ESLint.

$ node_modules/.bin/eslint --init
? How would you like to configure ESLint? Use a popular style guide
? Which style guide do you want to follow? Airbnb
? Do you use React? No
? What format do you want your config file to be in? JavaScript
Installing eslint-plugin-import, eslint-config-airbnb-base
/bin/sh: 1: npm: not found
Command failed: npm i --save-dev eslint-plugin-import eslint-config-airbnb-base
Error: Command failed: npm i --save-dev eslint-plugin-import eslint-config-airbnb-base
    at checkExecSyncError (child_process.js:481:13)
    at Object.execSync (child_process.js:521:13)
    at Object.installSyncSaveDev (/z/prg/js/node_modules/eslint/lib/util/npm-util.js:56:18)
    at installModules (/z/prg/js/node_modules/eslint/lib/config/config-initializer.js:99:17)
    at getConfigForStyleGuide (/z/prg/js/node_modules/eslint/lib/config/config-initializer.js:277:5)
    at inquirer.prompt.then.earlyAnswers (/z/prg/js/node_modules/eslint/lib/config/config-initializer.js:357:22)
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 23, 2017
@not-an-aardvark
Copy link
Member

Thanks for reporting. How did you end up with Node installed without npm being installed? Since npm is bundled with Node, I would have expected it to be a safe bet to assume it was installed.

@not-an-aardvark not-an-aardvark added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jun 23, 2017
@dandv
Copy link
Contributor Author

dandv commented Jun 23, 2017

@not-an-aardvark: I've uninstalled npm on purpose, to see how development would go with yarn alone. Haven't had a problem until now, and all operations have been much faster.

@platinumazure
Copy link
Member

Is it possible to bundle either npm or yarn as a dependency (without massively increasing the size of the published package)? Are there APIs we could call directly instead of relying on the presence of an executable in the user's path?

@not-an-aardvark
Copy link
Member

I think it might be easiest to just assume that npm is present, and print a useful error message if it's not. Given that npm is bundled with node, I suspect it's quite rare for users to not have npm installed. So we could do everything else, and then tell the user in an error message that "to finish the setup, you need to install these packages somehow."

@dandv
Copy link
Contributor Author

dandv commented Jun 24, 2017

Agree with @not-an-aardvark. I'm in the minority right now, but I suspect as yarn gets a larger foothold, others might disable npm as well. That will take a while though.

@not-an-aardvark
Copy link
Member

Fixed in #9169.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 27, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
None yet
Development

No branches or pull requests

4 participants