1

I am using smartAdmin to build an application. Whenever i install any package from npm and than try to run the app with

ng serve

it starts giving errors and I am unable to solve these errors and I have to restore some backup always.

recently I installed ngx-device-detector with

npm install ngx-device-detector --save

and than i run the application with

ng serve --open and the following errors appeared on the console.

ERROR in Metadata version mismatch for module D:/ob/Admin/ccAngular/node_modules/ngx-device-detector/ngx-device-detector.d.ts, found version 4, expected 3, resolving symbol HomeModule in D:/ob/Admin/ccAngular/src/app/home/home.module.ts, resolving symbol HomeModule in D:/ob/Admin/ccAngular/src/app/home/home.module.ts, resolving symbol HomeModule in D:/ob/Admin/ccAngular/src/app/home/home.module.ts

ERROR in ./~/jquery/lib/node-jquery.js
Module not found: Error: Can't resolve 'location' in 'D:\ob\Admin\ccAngular\node_modules\jquery\lib'
 @ ./~/jquery/lib/node-jquery.js 13:24-43
 @ ./src/lib.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in ./~/jquery/lib/node-jquery.js
Module not found: Error: Can't resolve 'navigator' in 'D:\ob\Admin\ccAngular\node_modules\jquery\lib'
 @ ./~/jquery/lib/node-jquery.js 17:25-45
 @ ./src/lib.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Can't resolve 'child_process' in 'D:\ob\Admin\ccAngular\node_modules\xmlhttprequest\lib'
 @ ./~/xmlhttprequest/lib/XMLHttpRequest.js 15:12-36
 @ ./~/jquery/lib/node-jquery.js
 @ ./src/lib.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in ./~/jsdom/lib/jsdom/living/xmlhttprequest.js
Module not found: Error: Can't resolve 'child_process' in 'D:\ob\Admin\ccAngular\node_modules\jsdom\lib\jsdom\living'
 @ ./~/jsdom/lib/jsdom/living/xmlhttprequest.js 4:18-42
 @ ./~/jsdom/lib/jsdom/browser/Window.js
 @ ./~/jsdom/lib/jsdom.js
 @ ./~/jquery/lib/node-jquery.js
 @ ./src/lib.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.

please help me solve this issue.

Ali Shan
  • 459
  • 7
  • 14
  • perhaps something to do with the path it is trying to read with windows like path bar \ instead of linux one `/` eg a `\n` is a line break escape character – Jorge Campos Nov 14 '18 at 15:56
  • 2
    remove package-lock.json file, and node_modules folder. Then do a fresh `npm install`. Looks like the version of the newly installed package is not compatible with the exiating packages. If you do a fresh `npm install` after removing the files mentioned above, hopefully these version conflicts would go away – Saptarshi Basu Nov 14 '18 at 16:22
  • @SaptarshiBasu I removed the node_modules folder and package-lock.json file and run the `npm install` command but when i run `ng server` it gives the same error – Ali Shan Nov 14 '18 at 17:26
  • why don't you try installing version 3 instead of 4 as mentioned in the first line of the error. – Saptarshi Basu Nov 14 '18 at 17:30

0 Answers0