Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New update: error during compiling in node modules #8

Open
ev0065 opened this issue Aug 5, 2019 · 11 comments
Open

New update: error during compiling in node modules #8

ev0065 opened this issue Aug 5, 2019 · 11 comments

Comments

@ev0065
Copy link

ev0065 commented Aug 5, 2019

Hi,

I just updated the packages and received a new error:

/node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js
Module parse failed: Unexpected token (6:20)
You may need an appropriate loader to handle this file type.
| const circle = require('@turf/circle').default;
| 
| const CircleMode = {...MapboxDraw.modes.draw_polygon};
| const DEFAULT_RADIUS_IN_KM = 2;
|

In my actual code, I am getting this error when I try to import it:

module "/home/user/workspace/node_modules/mapbox-gl-draw-circle/index" Could not find 
a declaration file for module 'mapbox-gl-draw-circle'. 
'/home/user/workspace/node_modules/mapbox-gl-draw-circle/index.js' implicitly 
has an 'any' type. 

Try `npm install @types/mapbox-gl-draw-circle` if it exists or add a new declaration 
(.d.ts) file containing `declare module 'mapbox-gl-draw-circle';`ts(7016)

I wanted to check and see if I was the only one receiving these errors or if my build somehow got screwed up. I did update the other modules that mapbox-gl-draw-circle uses but it didn't work.

@iamanvesh
Copy link
Owner

Are you using typescript? Looks like its complaining because I don't have a declaration file for the module. Can you try adding a declaration file?

@ev0065
Copy link
Author

ev0065 commented Aug 6, 2019

@iamanvesh So adding a declaration file with declare module 'mapbox-gl-draw-circle does not work. I'm still getting the same error as before when compiling. I do not believe that I am using typescript. I am currently using react-mapbox-gl and as well as other wrappers, mainly this one and mapbox draw. Do you have an idea why?

@iamanvesh
Copy link
Owner

@evan0065 Can you share your package.json configuration and some parts of your code to reproduce this issue?

@ajithes111
Copy link

+1

@moory
Copy link

moory commented Jul 12, 2021

How to solve it?

@moory
Copy link

moory commented Jul 12, 2021

./node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js Module parse failed: /Users/laoma/Documents/moory/2020.04/bird-map/node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js Unexpected token (6:20) You may need an appropriate loader to handle this file type. | const circle = require('@turf/circle'); | | const CircleMode = {...MapboxDraw.modes.draw_polygon}; | const DEFAULT_RADIUS_IN_KM = 2; |

@molinto
Copy link

molinto commented Apr 18, 2023

@moory Did you find a solution to this please?

Getting:~
"Could not find a declaration file for module 'mapbox-gl-draw-circle'. '/home/sharry/frontend/node_modules/mapbox-gl-draw-circle/index.js' implicitly has an 'any' type."

@mbrammer
Copy link

mbrammer commented Aug 3, 2023

If you are using TypeScript, add declare module 'mapbox-gl-draw-circle'; to your typings.d.ts.

@shivalika-techp
Copy link

@iamanvesh Thanks for building this library for circle support in mapbox-draw-gl.
I am facing the same issue while working with React 17.0.2 in Typescript
Import statement for CircleMode, DragCircleMode, DirectMode and SimpleSelectMode is throwing the following error:

Could not find a declaration file for module 'mapbox-gl-draw-circle'. 'c:/Users/fe/node_modules/mapbox-gl-draw-circle/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/mapbox-gl-draw-circle if it exists or add a new declaration (.d.ts) file containing declare module 'mapbox-gl-draw-circle';ts(7016)

These are the versions of the libraries that I am using:

"@mapbox/mapbox-gl-draw": "^1.3.0",
"mapbox-gl-draw-circle": "^1.1.2",

It would be helpful if you could suggest a solution to this issue and make the library work for my application.
Thank you!

@iamanvesh
Copy link
Owner

@ev0065 @shivalika-techp I'm not actively maintaining this library. I'll try and take a look at this issue this weekend, but feel free to clone and submit a PR for the fix.

@shivalika-techp
Copy link

@ev0065 @shivalika-techp I'm not actively maintaining this library. I'll try and take a look at this issue this weekend, but feel free to clone and submit a PR for the fix.

There is an open PR for updating mapbox-gl-draw support for this library, merging this will also be helpful-
#61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants