我正在按照本教程开发单个 Web 应用程序:
https://docs.angularjs.org/tutorial
导致我出现大问题的显然是 Protractor 端到端测试工具的正确配置。我已经完成了前面的所有步骤(安装 npm、bower、jasmine 等)。但是,每当我尝试对 Protractor 执行相同操作时(当然在正确的项目文件夹中),控制台都会输出:
angular-phonecat@0.0.0 protractor C:\Users\Michał Szydłowski\angular-phonecat
> protractor test/protractor-conf.js
util.puts: Use console.log instead
Using ChromeDriver directly...
[launcher] Error: Could not find chromedriver at C:\Users\Michał Szydłowski\angu
lar-phonecat\node_modules\protractor\selenium\chromedriver.exe
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! node v0.12.3
npm ERR! npm v2.9.1
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat@0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 protractor script 'protractor test
/protractor-conf.js'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Michał Szydłowski\angular-phonecat\npm-debug.log
C:\Users\Michał Szydłowski\angular-phonecat>
我尝试修改 package.json
文件以升级那里的 protractor
版本,或者手动添加 karma 命令行界面,但这些都没有帮助。有什么想法吗?
最佳答案
我注意到 NPM 在连接不良时表现不优雅。下载的依赖项可能会被破坏,因为要让 NPM 指示它已就位,其中有一个文件夹和“package.json”文件就足够了,但可能会丢失一些其他文件。我还注意到这种情况在 Mac 上更频繁地发生。
这会导致错误发生在不同的阶段,具体取决于使用损坏的依赖项的位置。
我发现的唯一解决方案是一个错误一个错误地找到提到的依赖项,从 node_modules
中删除它的文件夹并运行 npm i
( 的简写) npm install
) 用于包含此 node_modules
的包。
关于javascript - 如何解决 Protractor 的 'this fails on your system' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31024699/