question-mark
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.

BROWSER=none not working - react-dev-utils package from npm not up-to-date with git?

See original GitHub issue

Can you reproduce the problem with latest npm?

yes

Description

I wanted to use the BROWSER=none option, to prevent react-scripts from opening a new Browser. Setting the env variable did not work at all.

after checking the openBrowser.js file in node_modules/react-dev-utils/ I realized, that it is different from the openBrowser.js in the github repo:

/**

  • Copyright © 2015-present, Facebook, Inc.
  • All rights reserved.
  • This source code is licensed under the BSD-style license found in the
  • LICENSE file in the root directory of this source tree. An additional grant
  • of patent rights can be found in the PATENTS file in the same directory. */

var execSync = require(‘child_process’).execSync; var opn = require(‘opn’);

function openBrowser(url) { if (process.platform === ‘darwin’) { try { // Try our best to reuse existing tab // on OS X Google Chrome with AppleScript execSync(‘ps cax | grep “Google Chrome”’); execSync( 'osascript openChrome.applescript ’ + url, {cwd: __dirname, stdio: ‘ignore’} ); return true; } catch (err) { // Ignore errors. } } // Fallback to opn // (It will always open new tab) try { opn(url).catch(() => {}); // Prevent unhandledRejection error. return true; } catch (err) { return false; } }

This file does not contain the check for BROWSER=none, but in https://github.com/facebookincubator/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js it exists.

Expected behavior

using the env variable like BROWSER=none should prevent react-scripts from opening the browser

Actual behavior

When using BROWSER=none, the Browser still opens

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): wine-page@0.1.0 /home/beac0n/dev/wine-page └── react-scripts@0.8.5

  2. node -v: v7.5.0

  3. npm -v: 4.1.2

  4. Operating system: Arch Linux

I could reproduce the issue when creating a new project with create-react-app 1.0.3. I also ran npm cache clean, yarn cache clean - both commands with sudo and without.

I also downloaded the bundle manually from the npm registry: https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-0.4.2.tgz

The openBrowser.js file still isn’t the same as in the github repository.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gaearoncommented, Feb 11, 2017

0.9.0 is out now with support for this.

0reactions
lennerdcommented, Mar 17, 2017

Thank you for the explanations. I found and started to use the 0.6.0-beta release, so I can use the content reloading now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to open non default browsers when doing npm start for a ...
I would like to launch on firefox, safari and internet explorer for manual testing. I prefer don't making changes to package.json due to...
Read more >
react-dev-utils - npm
Start using react-dev-utils in your project by running `npm i react-dev-utils`. There are 6025 other projects in the npm registry using ...
Read more >
Electron@13 and Create-React-App | Mike Polinowski
electron-is-dev will open the Chromium Dev Tools when your app is not detached! ... concurrently --kill-others "BROWSER=none npm start" "npm run electron"
Read more >
What Does Create-React-App Actually Do? | by Andrew Mc
A new line is written to console. “Installing packages. This might take a couple of minutes.” Using everything previously determined it runs your...
Read more >
Troubleshooting - Create React App
When you save a file while npm start is running, the browser should refresh with the updated code. If this doesn't happen, try...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found