angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.77k stars 11.98k forks source link

Module not found: Error: Can't resolve 'fs' while using new MapboxDraw() #13289

Closed devcer closed 5 years ago

devcer commented 5 years ago

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node : 8.9.4 npm: 6.5.0 ng: 6.0.0 mapbox-gl-js version: 0.52.0 mapbox-gl-draw version: 1.1.1 ubuntu 18

Repro steps

npm i mapbox-gl && npm i @mapbox/mapbox-gl-draw
Include styles in angular.json and import mapbox using below lines
import * as mapboxgl from 'mapbox-gl';
import * as MapboxDraw from '@mapbox/mapbox-gl-draw';
Initialise MapboxDraw as
this.draw = new MapboxDraw();

The log given by the failure

ERROR in ./node_modules/jsonlint-lines/lib/jsonlint.js Module not found: Error: Can't resolve 'fs' in '/home/Documents/projects/Project_name/node_modules/jsonlint-lines/lib' ERROR in ./node_modules/jsonlint-lines/lib/jsonlint.js Module not found: Error: Can't resolve 'path' in '/home/gaian/Documents/projects/Project_name/node_modules/jsonlint-lines/lib

alan-agius4 commented 5 years ago

We only support building browser apps, and while building browser apps node native modules like fs are not available.

You can read more about why we disabled these imports in #9827.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.