Fallback to yarn when npm isn't installed
See original GitHub issue- 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)
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
[yarn with npm fallback] Try to install dependencies using yarn ...
[yarn with npm fallback] Try to install dependencies using yarn or fall back to npm if yarn is not available #nodejs #yarn #npm...
Read more >yarn pnp fallback to default require - node.js - Stack Overflow
The best solution is to install the dependency within the link: protocol yarn add --dev transport@link:./test/fixtures/transport.
Read more >fallback | Yarn - Package Manager
fallback. retry a function with a series of arguments until one works. usage. // run this in the repo: `npm install; node sample.js`...
Read more >connect-history-api-fallback - npm
Provides a fallback for non-existing directories so that the HTML 5 history API can be used.. Latest version: 2.0.0, last published: 6 ...
Read more >Problems with npm install after loading project files. - Treehouse
Pre-built binaries not found for fsevents@1.0.14 and node@10.13.0 (node-v64 ... install: `node-pre-gyp install --fallback-to-build` npm WARN ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.”
Fixed in https://github.com/eslint/eslint/pull/9169.