npm 错误 - 找不到模块“./selenium-webdriver/lib/input" [英] npm error - Cannot find module './selenium-webdriver/lib/input'

查看:96
本文介绍了npm 错误 - 找不到模块“./selenium-webdriver/lib/input"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我将 Angular 项目的版本从 5 更新到 7 后,我遇到了很多漏洞,需要修复它 - 我运行了npm 审计"中建议的所有命令,所有漏洞都得到了修复.

After I updated my Angular project's version from 5 to 7, I was getting a lot of vulnerabilities, to fix it - I ran all the commands that was suggested in the "npm audit" and all the vulnerabilities was fixed.

但是现在当我跑步时:

ng serve

我收到此错误:

node_modules/protractor/built/ptor.d.ts(33,17) 中的错误:错误 TS2307:找不到模块./selenium-webdriver/lib/input".

ERROR in node_modules/protractor/built/ptor.d.ts(33,17): error TS2307: Cannot find module './selenium-webdriver/lib/input'.

编辑

如果我进入错误源,我可以看到问题行:

Edit

If I get in to the errors sources I can see the problem line:

// node_modules/protractor/built/ptor.d.ts
 Key: import("./selenium-webdriver/lib/input").IKey;

如果我将行更改为:

 Key: import("../../selenium-webdriver/lib/input").IKey;

它修复了错误.

我想这是一个版本问题,但现在仍有待找出正确的版本.

I guess it's a versions issue, but now remains to find out what the correct versions.

这是我的 package.json 文件:

This is my package.json file:

{
"name": "test",
 "version": "1.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/core": "7.3.6",
"@angular/animations": "7.2.11",
"@angular/common": "7.2.11",
"@angular/compiler": "7.2.11",
"@angular/core": "7.2.11",
"@angular/forms": "7.2.11",
"@angular/http": "7.2.11",
"@angular/platform-browser": "7.2.11",
"@angular/platform-browser-dynamic": "7.2.11",
"@angular/router": "7.2.11",    
"core-js": "^2.4.1",
"rxjs": "^6.4.0",
"selenium-webdriver": "^4.0.0-alpha.1",
"tslib": "^1.9.0",
"zone.js": "^0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.7",
"@angular/cli": "7.3.6",
"@angular/compiler-cli": "7.2.11",
"@angular/language-service": "7.2.11",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "^4.0.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^6.0.0",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "3.2.4"
 },
"description": "This project was generated with [Angular CLI] 
(https://github.com/angular/angular-cli) version 1.6.3.",
"main": "/",
"repository": {
"type": "git",
"url": "/"
 },
"keywords": [
"/"
],
"author": "/"
}

知道为什么吗?

推荐答案

为了解决这个问题,我不得不运行这个命令:

To resolve this issue I had to run this command:

npm install protractor@latest --save

npm install protractor@latest --save

这篇关于npm 错误 - 找不到模块“./selenium-webdriver/lib/input"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆