【问题标题】:How to set path to protrator?如何设置量角器的路径?
【发布时间】:2020-08-04 20:57:48
【问题描述】:

我在运行 protactor 时收到此错误消息

错误信息:

protractor : The term 'protractor' is not      
recognized as the name of a cmdlet, function,  
script file, or operable program. Check the    
spelling of the name, or if a path was         
included, verify that the path is correct and  
try again.

我不小心删除了我的 node_modules 文件夹,但后来又添加了它,我在运行量角器或 webdriver-manager 时遇到了这个错误

我在尝试执行此操作时遇到此错误

npm install -g protractor
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\145702\AppData\Roaming\npm\node_modules\protractor\node_modules\.webdriver-manager.DELETE\selenium\MicrosoftWebDriver.exe
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\145702\AppData\Roaming\npm\node_modules\protractor\node_modules\.webdriver-manager.DELETE\selenium\MicrosoftWebDriver.exe'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\145702\AppData\Roaming\npm\node_modules\protractor\node_modules\.webdriver-manager.DELETE\selenium\MicrosoftWebDriver.exe'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\145702\AppData\Roaming\npm\node_modules\protractor\node_modules\.webdriver-manager.DELETE\selenium\MicrosoftWebDriver.exe'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'C:\\Users\\145702\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\.webdriver-manager.DELETE\\selenium\\MicrosoftWebDriver.exe'
npm ERR!   },
npm ERR!   stack: "Error: EPERM: operation not permitted, unlink 'C:\\Users\\145702\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\.webdriver-manager.DELETE\\selenium\\MicrosoftWebDriver.exe'",
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\145702\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\.webdriver-manager.DELETE\\selenium\\MicrosoftWebDriver.exe',
npm ERR!   parent: 'protractor'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\145702\AppData\Roaming\npm-cache\_logs\2020-04-22T00_49_43_150Z-debug.log


【问题讨论】:

    标签: selenium protractor


    【解决方案1】:

    运行这个命令:npm install -g protractor

    【讨论】:

      【解决方案2】:

      你试过了吗?

      1. 通过以下命令卸载量角器。
      npm uninstall -g protractor
      
      1. 从以下目录位置删除量角器文件夹(如果存在)。 C:\Users\145702\AppData\Roaming\npm\node_modules\

      2. 如果存在,请从以下位置删除量角器 windows cmd 文件。 C:\Users\145702\AppData\Roaming\npm

      3. 重新安装量角器。

      npm install -g protractor
      

      一个好的做法,不要全局安装量角器。请在项目级别安装并使用它。

      【讨论】:

      • 你好,我不得不删除在我的节点模块中为 webdriver-manager 创建的一个文件夹,该文件夹阻碍了量角器的安装,它再次工作,谢谢
      猜你喜欢
      • 2019-11-15
      • 2016-03-16
      • 1970-01-01
      • 1970-01-01
      • 2017-04-04
      • 2018-01-04
      • 2011-11-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多