运行'ng serve'时,量角器出现问题:严重依赖性

问题描述 投票:0回答:1

我和我的团队刚刚从Angular 7更新到Angular8。当我在执行“ git pull”更新本地存储库后尝试运行“ ng serve”时,我开始遇到执行问题。我被告知要删除我的node_module文件夹和package-locker.json文件,并在项目中运行npm install。突然问题开始了,由于显然是量角器程序包的依赖性,我不再能够运行我的应用程序。我警告大家,我在Stackoverflow上看到了一些可能的解决方案,但没有一个能够解决我的问题。

我按照建议尝试的解决方案:检查我的项目中是否存在任何量角器导入,例如从'量角器'导入{EventEmitter}。找不到。

以下是我的一些信息:

Angular CLI: 8.3.25
Node: 12.16.1
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.25
@angular-devkit/build-angular     0.803.25
@angular-devkit/build-optimizer   0.803.25
@angular-devkit/build-webpack     0.803.25
@angular-devkit/core              8.3.25
@angular-devkit/schematics        8.3.25
@angular/cli                      8.3.25
@ngtools/webpack                  8.3.25
@schematics/angular               8.3.25
@schematics/update                0.803.25
rxjs                              6.5.4
typescript                        3.5.3
webpack                           4.39.2

我的package.json文件:

{
  "name": "diarias-client-app",
  "version": "0.11.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "node version.ts && ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "npm run webdrivermanager:clean && npm run webdrivermanager:update && ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.2.14",
    "@angular/common": "^8.2.14",
    "@angular/compiler": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/forms": "^8.2.14",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/router": "^8.2.14",
    "@fortawesome/fontawesome-free": "^5.11.2",
    "@ng-bootstrap/ng-bootstrap": "^4.2.2",
    "@ng-select/ng-select": "^2.20.5",
    "ajv": "^6.10.2",
    "bootstrap": "^4.3.1",
    "core-js": "^2.6.10",
    "file-saver": "^2.0.2",
    "gerador-validador-cpf": "^3.1.3",
    "git-describe": "^4.0.4",
    "jquery": "^3.4.1",
    "jwt-decode": "^2.2.0",
    "leaflet": "^1.5.1",
    "leaflet-routing-machine": "^3.2.12",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.27",
    "ngx-bootstrap": "^4.3.0",
    "ngx-captcha": "^8.0.1",
    "ngx-currency": "^2.2.2",
    "ngx-mask": "^7.9.10",
    "ngx-permissions": "^6.0.6",
    "ngx-webstorage": "^3.0.2",
    "node-sass": "^4.13.0",
    "npm": "^6.11.3",
    "popper.js": "^1.16.0",
    "rxjs": "~6.5.4",
    "sass-loader": "^7.3.1",
    "uuid": "^3.3.3",
    "zone.js": "^0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.25",
    "@angular/cli": "^8.3.25",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/language-service": "^8.2.14",
    "@types/jasmine": "^2.8.16",
    "@types/jasminewd2": "^2.0.8",
    "@types/jquery": "^3.3.31",
    "@types/leaflet": "^1.5.1",
    "@types/leaflet-routing-machine": "^3.2.1",
    "@types/moment": "^2.13.0",
    "@types/moment-timezone": "^0.5.12",
    "@types/node": "^8.10.56",
    "codelyzer": "^5.2.0",
    "jasmine-core": "~2.99.1",
    "jasmine-data-provider": "^2.2.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.4.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.1.0",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.2",
    "protractor-beautiful-reporter": "^1.3.5",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.5.3"
  }
}

我的protractor.conf.js文件:

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');
const timeoutValue = 5 * 60 * 1000; //5 minutos

var HtmlReporter = require('protractor-beautiful-reporter');

exports.config = {
  allScriptsTimeout: timeoutValue,
  getPageTimeout: timeoutValue,

  //specs: [
  //  './src/**/*.e2e-spec.ts'
  //],

  suites: {

    //navegabilidade: './src/teste-fumaca.e2e-specs.ts',

    cenarios: [
      //'./src/cenarios/caminhoFeliz.e2e-specs.ts',
      //'./src/cenarios/colaboradorEventual.e2e-specs.ts',
      //'./src/cenarios/mebroRisco.e2e-specs.ts',
      './src/cenarios/outroBeneficiario.e2e-specs.ts',
    ]


  },

  capabilities: {
    'browserName': 'chrome',
    chromeOptions: {
      // How to set browser language (menus & so on)
      args: [
        'lang=pt-BR',
        'start-maximized'
      ],
    }
  },
  directConnect: false,
  seleniumServerJar: '../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar',
  baseUrl: 'http://localhost:4200/',
  //baseUrl: 'http://sistemadiarias.hmg.sistemas.intranet.mpba.mp.br',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: timeoutValue,
    print: function() {},
    expectationResultHandler(passed, assertion)
    {
      console.log(passed);
      console.log(assertion);
    }
  },
  onPrepare() {
    require('ts-node').register({
      project: require('path').join(__dirname, './tsconfig.e2e.json')
    });

    jasmine.getEnv().addReporter(new HtmlReporter({
      baseDirectory: './e2e/reports/',
      screenshotsSubfolder: 'screenshots',
      jsonsSubfolder: 'jsons',
      takeScreenShotsOnlyForFailedSpecs: true,
      preserveDirectory: false,
      clientDefaults : {
        columnSettings: {
          displayTime:        true,
          displayBrowser:     true,
          displaySessionId:   false,
          displayOS:          true,
          inlineScreenshots:  false
        }
      }

    }).getJasmine2Reporter());

    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: false } }));

  }
};

最后是我的日志,作为执行服务:

$ ng serve
i 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html

chunk {components-atendimento-analise-diarias-analise-diarias-module} components-atendimento-analise-diarias-analise-diarias-module.js, components-atendimento-analise-diarias-analise-diarias-module.js.map (components-atendimento-analise-diarias-analise-diarias-module) 45.3 kB  [rendered]
chunk {components-atendimento-dicofin-dicofin-module} components-atendimento-dicofin-dicofin-module.js, components-atendimento-dicofin-dicofin-module.js.map (components-atendimento-dicofin-dicofin-module) 142 kB  [rendered]
chunk {components-atendimento-unidade-gestora-unidade-gestora-module} components-atendimento-unidade-gestora-unidade-gestora-module.js, components-atendimento-unidade-gestora-unidade-gestora-module.js.map (components-atendimento-unidade-gestora-unidade-gestora-module) 134 kB  [rendered]
chunk {components-autorizacao-autorizacao-diarias-autorizacao-diarias-module} components-autorizacao-autorizacao-diarias-autorizacao-diarias-module.js, components-autorizacao-autorizacao-diarias-autorizacao-diarias-module.js.map (components-autorizacao-autorizacao-diarias-autorizacao-diarias-module) 63.7 kB  [rendered]
chunk {components-autorizacao-autorizacao-pgj-autorizacao-pgj-module} components-autorizacao-autorizacao-pgj-autorizacao-pgj-module.js, components-autorizacao-autorizacao-pgj-autorizacao-pgj-module.js.map (components-autorizacao-autorizacao-pgj-autorizacao-pgj-module) 52.3 kB  [rendered]
chunk {components-comprovacao-comprovacao-module} components-comprovacao-comprovacao-module.js, components-comprovacao-comprovacao-module.js.map (components-comprovacao-comprovacao-module) 97.3 kB  [rendered]
chunk {components-configuracao-configuracao-module} components-configuracao-configuracao-module.js, components-configuracao-configuracao-module.js.map (components-configuracao-configuracao-module) 95.7 kB  [rendered]
chunk {components-pedido-diaria-excedente-pedido-diaria-excedente-module} components-pedido-diaria-excedente-pedido-diaria-excedente-module.js, components-pedido-diaria-excedente-pedido-diaria-excedente-module.js.map (components-pedido-diaria-excedente-pedido-diaria-excedente-module) 36.2 kB  [rendered]
chunk {components-solicitacao-diarias-solicitacao-diarias-module} components-solicitacao-diarias-solicitacao-diarias-module.js, components-solicitacao-diarias-solicitacao-diarias-module.js.map (components-solicitacao-diarias-solicitacao-diarias-module) 33.6 kB  [rendered]
chunk {default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module} default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module.js, default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module.js.map (default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module) 3 MB  [rendered]
chunk {default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module~compo~4cfcf689} default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module~compo~4cfcf689.js, default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module~compo~4cfcf689.js.map (default~cadastro-solicitacao-diarias-cadastro-module~components-comprovacao-comprovacao-module~compo~4cfcf689) 368 kB  [rendered]
chunk {main} main.js, main.js.map (main) 982 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 319 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 719 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 10.4 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 2.21 MB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 3.47 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 9.07 MB [initial] [rendered]
Date: 2020-03-20T13:02:40.870Z - Hash: 15a198733bcc99a3b84c - Time: 48588ms

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/protractor/built/util.js 43:27-75
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/configParser.js 135:25-42
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/protractor/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/node_modules/webdriver-manager/built/lib/config.js 63:25-57
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/protractor/node_modules/webdriver-manager/built/lib/config.js 76: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 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'

WARNING in ./node_modules/protractor/built/configParser.js
Module not found: Error: Can't resolve 'coffee-script' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'

WARNING in ./node_modules/protractor/built/configParser.js
Module not found: Error: Can't resolve 'coffeescript' in 'C:\Projetos\diarias.frontend\ClientApp\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 'C:\Projetos\diarias.frontend\ClientApp\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 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\node_modules\source-map-support'

ERROR in ./node_modules/saucelabs/index.js
Module not found: Error: Can't resolve './lib-cov/SauceLabs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\saucelabs'
ERROR in ./node_modules/protractor/built/runner.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'
ERROR in ./node_modules/protractor/built/bpRunner.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'
ERROR in ./node_modules/selenium-webdriver/firefox/binary.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\firefox'
ERROR in ./node_modules/selenium-webdriver/io/exec.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\io'
ERROR in ./node_modules/selenium-webdriver/net/portprober.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\net'
ERROR in ./node_modules/blocking-proxy/built/lib/webdriver_logger.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\blocking-proxy\built\lib'
ERROR in ./node_modules/fs.realpath/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\fs.realpath'
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\fs.realpath'
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\glob'
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\glob'
ERROR in ./node_modules/protractor/built/logger.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'
ERROR in ./node_modules/protractor/built/driverProviders/local.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built\driverProviders'
ERROR in ./node_modules/protractor/built/driverProviders/direct.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built\driverProviders'
ERROR in ./node_modules/protractor/node_modules/webdriver-manager/built/lib/cli/logger.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\node_modules\webdriver-manager\built\lib\cli'
ERROR in ./node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\rimraf'
ERROR in ./node_modules/selenium-webdriver/chrome.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/phantomjs.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/opera.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/ie.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/edge.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver'
ERROR in ./node_modules/selenium-webdriver/firefox/profile.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\firefox'
ERROR in ./node_modules/selenium-webdriver/firefox/binary.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\firefox'
ERROR in ./node_modules/selenium-webdriver/firefox/extension.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\firefox'
ERROR in ./node_modules/selenium-webdriver/io/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\io'
ERROR in ./node_modules/selenium-webdriver/lib/devmode.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\lib'
ERROR in ./node_modules/selenium-webdriver/net/portprober.js
Module not found: Error: Can't resolve 'fs' in 'C:\Projetos\diarias.frontend\ClientApp\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 'C:\Projetos\diarias.frontend\ClientApp\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 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\remote'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\https-proxy-agent'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'net' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'
ERROR in ./node_modules/selenium-webdriver/net/portprober.js
Module not found: Error: Can't resolve 'net' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\selenium-webdriver\net'
ERROR in ./node_modules/protractor/built/debugger.js
Module not found: Error: Can't resolve 'repl' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\protractor\built'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\Projetos\diarias.frontend\ClientApp\node_modules\https-proxy-agent'
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, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> #!/usr/bin/env node
| "use strict";
| Object.defineProperty(exports, "__esModule", { value: true });
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

非常感谢您能给我任何帮助。我已经尝试了很多事情,直到现在对我没有任何作用。预先感谢。

node.js angular selenium protractor
1个回答
0
投票

https://www.floxblog.com/argument-of-type-string-is-not-assignable-to-parameter-of-type-string/

我在这里找到了相关问题的答案,并成功解决了。

© www.soinside.com 2019 - 2024. All rights reserved.