does not work with create-react-app
See original GitHub issueSteps 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:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closed in favor of issue #70
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.