BROWSER=none not working - react-dev-utils package from npm not up-to-date with git?
See original GitHub issueCan 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:
-
npm ls react-scripts
(if you haven’t ejected): wine-page@0.1.0 /home/beac0n/dev/wine-page └── react-scripts@0.8.5 -
node -v
: v7.5.0 -
npm -v
: 4.1.2 -
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:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
0.9.0 is out now with support for this.
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.