Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

not-an-aardvarkcommented, Jun 24, 2017

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.”

not-an-aardvarkcommented, Aug 30, 2017
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found