I generated a new application using angular-cli and added few components. I haven't added any test cases. when I try to run/build the app, I get the following lengthy error message:
ERROR in ./node_modules/selenium-webdriver/firefox/binary.js
Module not found: Error: Can't resolve 'child_process' in '/home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/firefox'
resolve 'child_process' in '/home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/firefox'
Parsed request is a module
using description file: /home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/package.json (relative path: ./firefox)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/package.json (relative path: ./firefox)
resolve as module
/home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/firefox/node_modules doesn't exist or is not a directory
/home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/node_modules doesn't exist or is not a directory
/home/myName/PROJECTS/MEAN/fruit-stall/node_modules doesn't exist or is not a directory
/home/myName/PROJECTS/MEAN/node_modules doesn't exist or is not a directory
/home/myName/PROJECTS/node_modules doesn't exist or is not a directory
/home/myName/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/node_modules
using description file: /home/myName/PROJECTS/MEAN/fruit-stall/fruitStall/node_modules/selenium-webdriver/package.json (relative path: ./node_modules)
Please find the detailed dump here.
OS: Ubuntu 16.04 LTS Angular version is: 5.0.2 node: 9.2.0
I also found a similar question being asked here, but it is related to the test cases. Since I haven't written any test cases, that did not help me.
Got the culprit!
I was adding some events to one of the component and visual studio code imported event emitter from selenium instead of angular-core.
deleted this
import { EventEmitter } from 'selenium-webdriver';
and updated this:
import { Component, OnInit, Input, EventEmitter } from '@angular/core';
Well, I don't have too much context here since you just posted errors, but this could be similar to Webpack and TypeScript: Cannot resolve module 'child_process' in node.d.ts.
Adding "target": "node"
to your webpack configs could resolve the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With