Angular2 - npm install didn't find namespace webdriver

狂风中的少年 提交于 2019-12-19 13:32:09

问题


After reinitiating an Angular2 project, I've launch the command npm install and got the following error :

node_modules/protractor/built/browser.d.ts(258,37): error TS2503: Cannot find namespace 'webdriver'

Anyone knows where it comes from/ how can I fixed it ?

Thanking you,


回答1:


Update 21-12-2016: This is fixed as of protractor 4.0.14.

protractor has a dependency on selenium-webdriver:

'@types/selenium-webdriver': '~2.53.31',

unfortunately, https://github.com/DefinitelyTyped/DefinitelyTyped/pull/13382 was merged yesterday and released as 2.53.37.

Temporary fix : manually installing version 2.53.36 fixes the problem until protractor releases a new version incorporating the changes from the selenium-webdriver package.

npm install @types/selenium-webdriver@2.53.36 --save-dev

and remove the dev dependency as soon as protractor is fixed.

There is a PR pending in : https://github.com/angular/protractor/pull/3848




回答2:


For those still experiencing issues after upgrading to Protractor 4.0.14, I found that my classes that referenced webdriver now required an import statement:

import webdriver = require('selenium-webdriver');

Hope that helps anyone with the same issue.



来源:https://stackoverflow.com/questions/41238376/angular2-npm-install-didnt-find-namespace-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!