Solution for turf.js error: Uncaught (in promise) Error: Invalid unit
Error code (npm i turf):
import turf from 'turf';
var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);
var options = {units: 'miles'};
var along = turf.along(line, 200, options); // Wrong
Correct code (NPMI @ turf/turf)
import * as turf from '@turf/turf';
var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);
var options = {units: 'miles'};
var along = turf.along(line, 200, options);
Read More:
- [Solved] echarts Draw Errror: echarts-d9fd185e.js:31447 Uncaught (in promise) Error: Initialize failed: invalid dom.
- How to solve Uncaught (in promise) error in VUE?
- [Solved] Echarts Error: Uncaught (in promise) Error: Initialize failed: invalid dom.
- request.js?b775:101 Uncaught (in promise) Error: Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Long’;
- How to Solve Uncaught (in promise) Error (Two Solutions)
- [Solved] vue-roter 4 Error: Error: Invalid route component/Uncaught (in promise) Error: Invalid route component
- Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to crrent location: “/home“
- Vue Error: Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
- [Solved] Uncaught (in promise) TypeError: XXX.a is not a constructor
- JS native implementation Promise.all
- [Solved] Uncaught (in promise) DOMException: Failed to load because no supported source was found.
- [Solved] Uncaught (in promise) Error: Avoided redundant navigation to current location:
- ArcGIS API for JavaScript Error Uncaught(in promise): TypeError: xxx is not a constructor
- About JS error uncaught syntax error: invalid shorthand property initializer
- Module not found: Error: Can‘t resolve ‘core-js/modules/es.promise.js‘ in
- Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs)
- [Solved] Binding onclick event in JS: for loop: error uncaught typeerror: cannot set properties of undefined (setting ‘classname’)
- JS async await Error: Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules
- [Solved] JS Error: Uncaught SyntaxError: Illegal return statement
- Solution to some map files in JS folder after Vue packaging (remove the map. JS file)