gpt4 book ai didi

Angular6 - 无法解析 selenium-webdriver\lib 中的 'fs'

转载 作者:太空狗 更新时间:2023-10-29 17:30:11 26 4
gpt4 key购买 nike

我在我的 Angular 项目中运行“ng 测试”时遇到问题。当我运行时,我得到以下输出:

ERROR in ./node_modules/selenium-webdriver/lib/http.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\test\Desktop\ui-portal\node_modules\selenium-webdriver\lib' @ ./node_modules/selenium-webdriver/lib/http.js 28:11-24 @ ./node_modules/selenium-webdriver/http/index.js @ ./src/app/container/container.component.spec.ts @ ./src .spec.ts$ @ ./src/test.ts

-

ERROR in ./node_modules/selenium-webdriver/lib/devmode.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\test\Desktop\ui-portal\node_modules\selenium-webdriver\lib' @ ./node_modules/selenium-webdriver/lib/devmode.js 25:11-24 @ ./node_modules/selenium-webdriver/lib/http.js @ ./node_modules/selenium-webdriver/http/index.js @ ./src/app/container/container.component.spec.ts @ ./src .spec.ts$ @ ./src/test.ts

我一直在寻找答案,但找不到任何有用的答案 - 有没有人以前见过这个特定问题?我的 package.json 文件如下:

{
"name": "ui-portal",
"version": "0.0.1",
"license": "MIT",
"scripts": {
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@ngx-translate/core": "9.1.1",
"@ngx-translate/http-loader": "2.0.1",
"applicationinsights-js": "^1.0.18",
"bootstrap": "3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"ng4-loading-spinner": "^1.1.3",
"ngx-bootstrap": "^3.0.1",
"rxjs": "^5.5.6",
"source-sans-pro": "^2.20.2",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "1.6.5",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@compodoc/compodoc": "^1.0.1",
"@types/chai": "^3.5.1",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"diff": "^3.4.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-mocha-reporter": "^2.2.3",
"karma-sourcemap-loader": "^0.3.7",
"karma-tfs-reporter": "^1.0.1",
"mocha": "^4.0.1",
"onchange": "^3.2.1",
"protractor": "~5.1.2",
"rimraf": "^2.6.1",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3",
"webpack-bundle-analyzer": "^2.9.0"
}
}

在此先感谢您的指点!真的没有在这方面取得进展:(

最佳答案

我在 ng test on 上遇到了同样的问题

Angular CLI: 6.1.2 Node: 8.9.1

我的问题是使用

wrong HttpClient. import in my test file.

确保您的 HttpClient 来自 '@angular/common/http'; 而不是从 Selenium 导入。

希望这有帮助:)

关于Angular6 - 无法解析 selenium-webdriver\lib 中的 'fs',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51020174/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com