量角器错误

时间:2017-05-08 22:43:36

标签: angularjs protractor

我现在已经花了几个小时与量角器挣扎,我甚至都没能进行第一次测试。要启动它,我使用的是npm run e2e,它会产生以下错误:

  ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! angular-quickstart@1.0.0 protractor: `protractor 
protractor.config.js`
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the angular-quickstart@1.0.0 protractor script 'protractor protractor.config.js'.
[1] npm ERR! Make sure you have the latest version of node.js and npm installed.
[1] npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
[1] npm ERR! not with npm itself.
[1] npm ERR! Tell the author that this fails on your system:
[1] npm ERR!     protractor protractor.config.js
[1] npm ERR! You can get information on how to open an issue for this project with:
[1] npm ERR!     npm bugs angular-quickstart
[1] npm ERR! Or if that isn't available, you can get their info via:
[1] npm ERR!     npm owner ls angular-quickstart
[1] npm ERR! There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     C:\Users\Jesper\AppData\Roaming\npm-cache\_logs\2017-05-08T22_41_36_233Z-debug.log
[1] npm run protractor exited with code 1
--> Sending SIGTERM to other processes..
[0] npm run serve:e2e exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-quickstart@1.0.0 e2e: `concurrently "npm run serve:e2e" "npm 
run protractor" --kill-others --success first`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 e2e script 'concurrently "npm 
run serve:e2e" "npm run protractor" --kill-others --success first'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart 
package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     concurrently "npm run serve:e2e" "npm run protractor" --kill-others --success first
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jesper\AppData\Roaming\npm-cache\_logs\2017-05-
08T22_24_18_355Z-debug.log

我完全不知道该做什么。我该怎么做才能解决这个错误?我已经更新了nodes.js和npm。他们的版本现在分别为6.10.3和4.5.0。

另外,我不知道我是否应该有2个配置文件。我找到了一个指南,告诉我创建一个config.js文件,我在e2e文件夹中创建了该文件。我还发现了一个protractor.config.js文件,我猜这个文件默认位于angular-quickstart项目中。两者都是必需的,还是应该删除conf.js

以下是日志文件的内容:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Jesper\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'e2e' ]
2 info using npm@4.5.0
3 info using node@v6.10.3
4 verbose run-script [ 'pree2e', 'e2e', 'poste2e' ]
5 info lifecycle angular-quickstart@1.0.0~pree2e: angular-quickstart@1.0.0
6 verbose lifecycle angular-quickstart@1.0.0~pree2e: unsafe-perm in lifecycle true
7 verbose lifecycle angular-quickstart@1.0.0~pree2e: PATH: C:\Users\Jesper\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\Jesper\Documents\GitHub\StudentDatabaseFrontEnd\Student Database\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Brackets\command;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Skype\Phone\;C:\Users\Jesper\AppData\Roaming\npm;C:\Users\Jesper\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft VS Code\bin
8 verbose lifecycle angular-quickstart@1.0.0~pree2e: CWD: C:\Users\Jesper\Documents\GitHub\StudentDatabaseFrontEnd\Student Database
9 silly lifecycle angular-quickstart@1.0.0~pree2e: Args: [ '/d /s /c', 'npm run build:e2e' ]
10 silly lifecycle angular-quickstart@1.0.0~pree2e: Returned: code: 0  signal: null
11 info lifecycle angular-quickstart@1.0.0~e2e: angular-quickstart@1.0.0
12 verbose lifecycle angular-quickstart@1.0.0~e2e: unsafe-perm in lifecycle true
13 verbose lifecycle angular-quickstart@1.0.0~e2e: PATH: C:\Users\Jesper\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\Jesper\Documents\GitHub\StudentDatabaseFrontEnd\Student Database\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Brackets\command;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Skype\Phone\;C:\Users\Jesper\AppData\Roaming\npm;C:\Users\Jesper\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft VS Code\bin
14 verbose lifecycle angular-quickstart@1.0.0~e2e: CWD: C:\Users\Jesper\Documents\GitHub\StudentDatabaseFrontEnd\Student Database
15 silly lifecycle angular-quickstart@1.0.0~e2e: Args: [ '/d /s /c',
15 silly lifecycle   'concurrently "npm run serve:e2e" "npm run protractor" --kill-others --success first' ]
16 silly lifecycle angular-quickstart@1.0.0~e2e: Returned: code: 1  signal: null
17 info lifecycle angular-quickstart@1.0.0~e2e: Failed to exec e2e script
18 verbose stack Error: angular-quickstart@1.0.0 e2e: `concurrently "npm run serve:e2e" "npm run protractor" --kill-others --success first`
18 verbose stack Exit status 1
18 verbose stack     at EventEmitter.<anonymous> (C:\Users\Jesper\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
18 verbose stack     at emitTwo (events.js:106:13)
18 verbose stack     at EventEmitter.emit (events.js:191:7)
18 verbose stack     at ChildProcess.<anonymous> (C:\Users\Jesper\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
18 verbose stack     at emitTwo (events.js:106:13)
18 verbose stack     at ChildProcess.emit (events.js:191:7)
18 verbose stack     at maybeClose (internal/child_process.js:886:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
19 verbose pkgid angular-quickstart@1.0.0
20 verbose cwd C:\Users\Jesper\Documents\GitHub\StudentDatabaseFrontEnd\Student Database\e2e
21 verbose Windows_NT 10.0.14393
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Jesper\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "e2e"
23 verbose node v6.10.3
24 verbose npm  v4.5.0
25 error code ELIFECYCLE
26 error errno 1
27 error angular-quickstart@1.0.0 e2e: `concurrently "npm run serve:e2e" "npm run protractor" --kill-others --success first`
27 error Exit status 1
28 error Failed at the angular-quickstart@1.0.0 e2e script 'concurrently "npm run serve:e2e" "npm run protractor" --kill-others --success first'.
28 error Make sure you have the latest version of node.js and npm installed.
28 error If you do, this is most likely a problem with the angular-quickstart package,
28 error not with npm itself.
28 error Tell the author that this fails on your system:
28 error     concurrently "npm run serve:e2e" "npm run protractor" --kill-others --success first
28 error You can get information on how to open an issue for this project with:
28 error     npm bugs angular-quickstart
28 error Or if that isn't available, you can get their info via:
28 error     npm owner ls angular-quickstart
28 error There is likely additional logging output above.
29 verbose exit [ 1, true ]

这是我的文件夹结构:

enter image description here

2 个答案:

答案 0 :(得分:0)

根据我的想法,错误消息应该在测试失败时出现,但我不确定原因。对于像我这样认为有问题的新用户来说,这可能会令人困惑。

答案 1 :(得分:0)

你最好的选择是阅读基础知识,我推荐这个网站: http://www.softwaretestinghelp.com/protractor-testing-tutorial/

您需要两个文件才能启动Protractor测试。一个文件是conf.js,另一个是存储测试的文件(spec.js,test.spec.js)。确保在conf文件中编写了正确的spec文件名:

// conf.js
exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js'] //spec file name
}
相关问题