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.

npm wizards, we need your help!

Per @pselle’s suggestion, we should try to find a way to make create-react-app work offline.

I’m not well versed in npm flags and likely won’t have time for this, so this is a perfect opportunity for you to contribute and significantly improve the user experience of Create React App.

Here is the behavior we’re looking for:

  • Existing requirement: create-react-app my-app should use the most recent version of react-scripts if you are online. We are not changing this: we always want the users to get the most recent one.
  • New requirement: create-react-app my-app should not crash offline if you ran it at least once before. It should be able to use locally cached react-scripts in this case, if it exists.
  • Bonus: create-react-app my-app should use cached react-scripts if it knows the latest npm version is cached locally. In other words, even if you are online, we shouldn’t just refetch the whole thing if we have it locally and we know it is the latest version. This is not required but would make a big difference for most people.
  • Acceptable tradeoff: we are fine with not installing the latest transitive dependencies. In other words it’s fine if react-scripts depends on some-package@1.0.0, then some-package@1.0.1 comes out, but we keep using the cached some-package@1.0.0.

How to achieve this? I have no idea.

Maybe this would be helpful: https://addyosmani.com/blog/using-npm-offline/.

We already use bundledDependencies (which is a bit unusual) as part of our build process so in reality react-scripts is being downloaded as a single tarball rather than through the usual npm process. Perhaps this can give us the leverage to make this better (e.g. by caching that tarball somehow).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:28 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Oct 11, 2016

We might have another solution to this soon.

2reactions
apaleslimghostcommented, Aug 5, 2016

I’m not sure how this fits with bundledDependencies but in npm >= 3.9 --cache-min=999999999 is pretty much exactly what you’re looking for https://github.com/npm/npm/releases/tag/v3.9.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Offline Mode
Offline Mode is an extension that lets you easily disconnect your browser from the internet. The toolbar button serves as an ON|OFF switch....
Read more >
How to Set Up Offline Mode - Google Chromebooks
1. Make sure you’re connected to the internet. 2. Open Google Docs. 3. Open the menu. Select Settings.
Read more >
How do I use the mobile app when I am offline (Offline Mode)?
Offline Mode allows field workers to use the mobile app when they do not have access to internet. It must be enabled and...
Read more >
Google Drive: How to Enable and Disable Offline Mode - Dell
This is a Guide on Google Drive, how to enable and disable 'activate Offline Mode' for files to access them without an Internet...
Read more >
Use your Chromebook offline - Google Support
Some offline apps and services won't work in Incognito or guest mode. If you're using Gmail with your work or school account, you...
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