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.

does not work with create-react-app

See original GitHub issue

Steps to recreate:

Create a new app:

npm install -g create-react-app
create-react-app my-app
cd my-app
npm start

works.

Install leaflet and leaflet-measure:

npm i --save leaflet leaflet-measure

Import into my-app/src/App.js:

import 'leaflet'
import 'leaflet-measure'

See this error in the console:

leaflet-measure.js:15Uncaught TypeError: fs.readFileSync is not a function
    at Object.<anonymous> (leaflet-measure.js:15)
    at Object.<anonymous> (leaflet-measure.js:457)
    at __webpack_require__ (bootstrap 056f279…:555)
    at fn (bootstrap 056f279…:86)
    at Object.<anonymous> (App.js:6)
    at __webpack_require__ (bootstrap 056f279…:555)
    at fn (bootstrap 056f279…:86)
    at Object.<anonymous> (index.js:3)
    at __webpack_require__ (bootstrap 056f279…:555)
    at fn (bootstrap 056f279…:86)
(anonymous) @ leaflet-measure.js:15
(anonymous) @ leaflet-measure.js:457
__webpack_require__ @ bootstrap 056f279…:555
fn @ bootstrap 056f279…:86
(anonymous) @ App.js:6
__webpack_require__ @ bootstrap 056f279…:555
fn @ bootstrap 056f279…:86
(anonymous) @ index.js:3
__webpack_require__ @ bootstrap 056f279…:555
fn @ bootstrap 056f279…:86
(anonymous) @ bootstrap 056f279…:578
__webpack_require__ @ bootstrap 056f279…:555
(anonymous) @ bootstrap 056f279…:578
(anonymous) @ bootstrap 056f279…:578

May be related to https://github.com/ljagis/leaflet-measure/issues/30 and https://github.com/ljagis/leaflet-measure/issues/67

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
brandoncopelandcommented, Feb 28, 2017

Closed in favor of issue #70

0reactions
brandoncopelandcommented, Feb 28, 2017

This control is built with Browserify and intended to be used from the dist directory. It has been this way since originally built in 2015.

I would like to update the build to webpack but have not yet had the opportunity. Until then, importing from dist is probably the best solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create React App not working - Stack Overflow
1. update the npm version (npm install npm@latest -g) · 2. clear the cache (npm cache clean --force) · 3. create the react...
Read more >
What To Do if create-react-app Doesn't Work
1. npm uninstall -g create-react-app. This is the npm command to uninstall your global installation of create-react-app .
Read more >
npx create-react-app not working? Here's the solution.
The current solution is simple — run create-react-app and target the latest version. Run creact-react-app using the latest version. npx create- ...
Read more >
npx create-react-app is not working · Issue #10132 - GitHub
I am able to solve the problem by first trying to uninstall the npm globally, update the npm, clear the cache then using...
Read more >
The problem with adopting create-react-app for production
But in real life, your application will not stay within the proposed limits of the create-react-app framework. Sooner or later, your app will...
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