angular-cli: ng serve throws 'Critical dependency' and 'Module not found' warnings/errors
Bug Report or Feature Request (mark with an x
)
- [x] bug report
- [ ] 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: v8.12.0 NPM: 6.4.1 Yarn: 1.10.1 OS: macOS Mojave 10.14
Angular CLI: 7.0.3
Node: 8.12.0
OS: darwin x64
Angular: 7.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.3
@angular-devkit/build-angular 0.10.3
@angular-devkit/build-optimizer 0.10.3
@angular-devkit/build-webpack 0.10.3
@angular-devkit/core 7.0.3
@angular-devkit/schematics 7.0.3
@angular/cli 7.0.3
@ngtools/webpack 7.0.3
@schematics/angular 7.0.3
@schematics/update 0.10.3
rxjs 6.3.3
typescript 3.1.3
webpack 4.19.1
Repro steps
- Regular Angular app created with
ng new project -g -S --routing -style scss
- One lazy feature module loading (WORKS FINE WITHOUT IT)
- Newest Angular packages (same as these generated by the newest CLI)
tsconfig.json
s not modified- Moved
styles.scss
tosrc/styles/styles.scss
with properangular.json
modification - Reorganized the structure - same as https://ngrx.github.io/platform/stackblitz.html
- Ngrx packages installed but only applied to the the router (I know it hasn’t been updated to 7.x but I guess it’s not the root cause) and nothing else has been done with it
The log given by the failure
❯ ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-10-25T17:05:01.786Z
Hash: 2dcdadeea69b2602e22e
Time: 20815ms
chunk {drawer-drawer-module} drawer-drawer-module.js, drawer-drawer-module.js.map (drawer-drawer-module) 2.13 MB [rendered]
chunk {main} main.js, main.js.map (main) 29.6 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 228 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 9.05 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 613 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.22 MB [initial] [rendered]
WARNING in ./node_modules/protractor/built/debugger.js 40:33-40
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
WARNING in ./node_modules/protractor/built/runner.js 405:19-41
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/webdriver-manager/built/lib/config.js 62:25-57
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/webdriver-manager/built/lib/config.js 47:25-57
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/protractor/built/configParser.js 135:25-42
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/protractor/built/plugins.js 52:32-45
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/protractor/built/util.js 43:27-75
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/webdriver-manager/built/lib/config.js 75:26-59
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/protractor/built/configParser.js
Module not found: Error: Can't resolve 'LiveScript' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
WARNING in ./node_modules/protractor/built/configParser.js
Module not found: Error: Can't resolve 'coffee-script' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
WARNING in ./node_modules/protractor/built/configParser.js
Module not found: Error: Can't resolve 'coffeescript' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
WARNING in ./node_modules/protractor/node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/protractor/node_modules/source-map-support'
WARNING in ./node_modules/protractor/node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'module' in '/Users/danield/Desktop/barn-io/node_modules/protractor/node_modules/source-map-support'
WARNING in ./node_modules/minimatch/minimatch.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/minimatch'
WARNING in ./node_modules/sax/lib/sax.js
Module not found: Error: Can't resolve 'stream' in '/Users/danield/Desktop/barn-io/node_modules/sax/lib'
ERROR in ./node_modules/saucelabs/index.js
Module not found: Error: Can't resolve './lib-cov/SauceLabs' in '/Users/danield/Desktop/barn-io/node_modules/saucelabs'
ERROR in ./node_modules/protractor/built/runner.js
Module not found: Error: Can't resolve 'child_process' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'child_process' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/protractor/built/bpRunner.js
Module not found: Error: Can't resolve 'child_process' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/selenium-webdriver/firefox/binary.js
Module not found: Error: Can't resolve 'child_process' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/io/exec.js
Module not found: Error: Can't resolve 'child_process' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/io'
ERROR in ./node_modules/selenium-webdriver/net/portprober.js
Module not found: Error: Can't resolve 'child_process' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/net'
ERROR in ./node_modules/saucelabs/lib/SauceLabs.js
Module not found: Error: Can't resolve 'crypto' in '/Users/danield/Desktop/barn-io/node_modules/saucelabs/lib'
ERROR in ./node_modules/selenium-webdriver/node_modules/tmp/lib/tmp.js
Module not found: Error: Can't resolve 'crypto' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/node_modules/tmp/lib'
ERROR in ./node_modules/blocking-proxy/built/lib/webdriver_logger.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/blocking-proxy/built/lib'
ERROR in ./node_modules/fs.realpath/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/fs.realpath'
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/fs.realpath'
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/glob'
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/glob'
ERROR in ./node_modules/protractor/built/logger.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/protractor/built/driverProviders/direct.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built/driverProviders'
ERROR in ./node_modules/protractor/built/driverProviders/local.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built/driverProviders'
ERROR in ./node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/rimraf'
ERROR in ./node_modules/selenium-webdriver/chrome.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/opera.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/edge.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/ie.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/phantomjs.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/firefox/profile.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/firefox/binary.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/firefox/extension.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/io/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/io'
ERROR in ./node_modules/selenium-webdriver/lib/devmode.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/lib'
ERROR in ./node_modules/selenium-webdriver/net/portprober.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/net'
ERROR in ./node_modules/selenium-webdriver/node_modules/tmp/lib/tmp.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/node_modules/tmp/lib'
ERROR in ./node_modules/selenium-webdriver/remote/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/remote'
ERROR in ./node_modules/webdriver-manager/built/lib/cli/logger.js
Module not found: Error: Can't resolve 'fs' in '/Users/danield/Desktop/barn-io/node_modules/webdriver-manager/built/lib/cli'
ERROR in ./node_modules/blocking-proxy/built/lib/simple_webdriver_client.js
Module not found: Error: Can't resolve 'http' in '/Users/danield/Desktop/barn-io/node_modules/blocking-proxy/built/lib'
ERROR in ./node_modules/blocking-proxy/built/lib/webdriver_proxy.js
Module not found: Error: Can't resolve 'http' in '/Users/danield/Desktop/barn-io/node_modules/blocking-proxy/built/lib'
ERROR in ./node_modules/blocking-proxy/built/lib/blockingproxy.js
Module not found: Error: Can't resolve 'http' in '/Users/danield/Desktop/barn-io/node_modules/blocking-proxy/built/lib'
ERROR in ./node_modules/blocking-proxy/built/lib/client.js
Module not found: Error: Can't resolve 'http' in '/Users/danield/Desktop/barn-io/node_modules/blocking-proxy/built/lib'
ERROR in ./node_modules/browserstack/lib/client.js
Module not found: Error: Can't resolve 'http' in '/Users/danield/Desktop/barn-io/node_modules/browserstack/lib'
ERROR in ./node_modules/selenium-webdriver/http/index.js
Module not found: Error: Can't resolve 'http' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/http'
ERROR in ./node_modules/agent-base/patch-core.js
Module not found: Error: Can't resolve 'https' in '/Users/danield/Desktop/barn-io/node_modules/agent-base'
ERROR in ./node_modules/browserstack/lib/client.js
Module not found: Error: Can't resolve 'https' in '/Users/danield/Desktop/barn-io/node_modules/browserstack/lib'
ERROR in ./node_modules/saucelabs/lib/SauceLabs.js
Module not found: Error: Can't resolve 'https' in '/Users/danield/Desktop/barn-io/node_modules/saucelabs/lib'
ERROR in ./node_modules/selenium-webdriver/http/index.js
Module not found: Error: Can't resolve 'https' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/http'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'net' in '/Users/danield/Desktop/barn-io/node_modules/https-proxy-agent'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'net' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/selenium-webdriver/net/portprober.js
Module not found: Error: Can't resolve 'net' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/net'
ERROR in ./node_modules/browserstack/lib/client.js
Module not found: Error: Can't resolve 'os' in '/Users/danield/Desktop/barn-io/node_modules/browserstack/lib'
ERROR in ./node_modules/selenium-webdriver/net/index.js
Module not found: Error: Can't resolve 'os' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/net'
ERROR in ./node_modules/webdriver-manager/built/lib/config.js
Module not found: Error: Can't resolve 'os' in '/Users/danield/Desktop/barn-io/node_modules/webdriver-manager/built/lib'
ERROR in ./node_modules/blocking-proxy/built/lib/webdriver_logger.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/blocking-proxy/built/lib'
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/fs.realpath'
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/glob'
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/glob'
ERROR in ./node_modules/glob/common.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/glob'
ERROR in ./node_modules/protractor/built/logger.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/protractor/built/util.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/protractor/built/configParser.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/protractor/built/driverProviders/local.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built/driverProviders'
ERROR in ./node_modules/protractor/built/driverProviders/direct.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built/driverProviders'
ERROR in ./node_modules/protractor/node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/protractor/node_modules/source-map-support'
ERROR in ./node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/rimraf'
ERROR in ./node_modules/selenium-webdriver/firefox/profile.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/firefox/binary.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/firefox/extension.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/selenium-webdriver/io/zip.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/io'
ERROR in ./node_modules/selenium-webdriver/io/index.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/io'
ERROR in ./node_modules/selenium-webdriver/lib/devmode.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/lib'
ERROR in ./node_modules/selenium-webdriver/node_modules/tmp/lib/tmp.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/node_modules/tmp/lib'
ERROR in ./node_modules/selenium-webdriver/remote/index.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/remote'
ERROR in ./node_modules/webdriver-js-extender/built/lib/command_definition.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/webdriver-js-extender/built/lib'
ERROR in ./node_modules/webdriver-manager/built/lib/config.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/webdriver-manager/built/lib'
ERROR in ./node_modules/webdriver-manager/built/lib/cli/logger.js
Module not found: Error: Can't resolve 'path' in '/Users/danield/Desktop/barn-io/node_modules/webdriver-manager/built/lib/cli'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'repl' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/jszip/lib/readable-stream-browser.js
Module not found: Error: Can't resolve 'stream' in '/Users/danield/Desktop/barn-io/node_modules/jszip/lib'
ERROR in ./node_modules/xml2js/lib/parser.js
Module not found: Error: Can't resolve 'timers' in '/Users/danield/Desktop/barn-io/node_modules/xml2js/lib'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/Users/danield/Desktop/barn-io/node_modules/https-proxy-agent'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'vm' in '/Users/danield/Desktop/barn-io/node_modules/protractor/built'
ERROR in ./node_modules/selenium-webdriver/firefox/profile.js
Module not found: Error: Can't resolve 'vm' in '/Users/danield/Desktop/barn-io/node_modules/selenium-webdriver/firefox'
ERROR in ./node_modules/blocking-proxy/built/lib/bin.js 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
> #!/usr/bin/env node
| "use strict";
| Object.defineProperty(exports, "__esModule", { value: true });
ℹ 「wdm」: Failed to compile.
Desired functionality
The app should start normally.
Mention any other details that might be useful
- WORKS FINE WITHOUT LAZY LOADING FEATURE MODULES
- Tried both with NPM and Yarn (removed
node_modules
, reinstall,ng serve
) - Nothing extraordinary in the project
- Node with NVM
package.json
{
"name": "app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.0.0",
"@angular/cdk": "^7.0.1",
"@angular/common": "~7.0.0",
"@angular/compiler": "~7.0.0",
"@angular/core": "~7.0.0",
"@angular/forms": "~7.0.0",
"@angular/http": "~7.0.0",
"@angular/material": "^7.0.1",
"@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0",
"@angular/router": "~7.0.0",
"@ngrx/entity": "^6.1.0",
"@ngrx/router-store": "^6.1.0",
"@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0",
"angular-svg-icon": "^6.0.1",
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"rxjs": "~6.3.3",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.0",
"@angular/cli": "~7.0.3",
"@angular/compiler-cli": "~7.0.0",
"@angular/language-service": "~7.0.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"stylelint": "^9.6.0",
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-recommended-scss": "^3.2.0",
"stylelint-scss": "^3.3.2",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"tslint-config-prettier": "^1.15.0",
"typescript": "~3.1.1"
}
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (3 by maintainers)
@dannydtk had the same issue - for anyone else who may come across this, when adding
EventEmitter
to an Angular component, the auto import in VS Code added this line:Yikes. Wish I had found this post an hour sooner!
From the log output it appears
protractor
has been imported into the application accidentally.@clydin Yeah, I’ve accidentally imported
Protractor
… This might be my biggest mistake ever 😬Thank you very much! The issue can be closed now.Oh my god thank you so much
@kmjungersen You just saved me hours!
no problem. Things like that happen.
Has anyone reported this to the appropriate VS Code and/or Extension that controls that?
Seems like it is prioritizing a dev dependency over a normal dependency and one that is in @angular/core should probably be imported over protractor for sure.
Thanks a lot
@dannydtk I made that mistake too thats what dive me in here. Vs code -> ) :