how to import node npm module in angular 6
11,436
import * as findLocalDevices from 'local-devices'
and inside any method use it as
ngOnInit() {
console.log(findLocalDevices());
}
you may require to install other packages also os child_process / mz
Author by
WasiF
Updated on June 17, 2022Comments
-
WasiF almost 2 years
I have installed the package
npm install local-devices
and imported it in
angular.json
as"scripts": [ "./node_modules/local-devices/index.js" ]
and declared as
global variable
insrc/typings.d.ts
declare let findLocalDevices: any
Below,
package
files structure andindex.js
oflocal-devices
packagethen tried to use it in a component as
console.log(findLocalDevices())
but got error
findLocalDevices is not defined
How to import it, please guide!!!
-
WasiF over 5 yearsModule not found: Error: Can't resolve 'child_process' in '\node_modules\mz'. How to resolve this?