简体   繁体   中英

Protractor unable to find config file: Error: Cannot find module '/protractor/protractor.conf_sanity.js'

Protractor version: 5.4.2

Present working directory: /protractor

CLI to run the test: sudo -u protractor xvfb-run --server-args="-screen 0 1280x1024x24" -a protractor $@

File is present in the directory: -rw-rw-rw-. 1 jenkins jenkins 5528 Nov 23 07:14 protractor.conf_sanity.js -rw-rw-rw-. 1 jenkins jenkins 5528 Nov 23 07:14 protractor.conf_sanity.js

The test is failing with below error:

[06:37:35] E/configParser - Error code: 105

[06:37:35] E/configParser - Error message: failed loading configuration file protractor.conf_sanity.js

[06:37:35] E/configParser - Error: Cannot find module '/protractor/protractor.conf_sanity.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at ConfigParser.addFileConfig (/usr/lib/node_modules/protractor/built/configParser.js:135:26)
    at Object.initFn [as init] (/usr/lib/node_modules/protractor/built/launcher.js:93:22)
    at Object.<anonymous> (/usr/lib/node_modules/protractor/built/cli.js:226:10)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)

I have been scratching my head for a few days for this. What am I missing?

I add pwd and ls -lrt $@ to the entrypoint script and it is finding the file.

/protractor

-rw-rw-rw-. 1 jenkins jenkins 5528 Nov 23 07:14 protractor.conf_dev_sanity.js

A shot in a dark...

Your CLI command looks weird to me

I start tests like so

xvfb-run -a --server-args="-screen 0 ${SCREEN_RES}" protractor protractor.conf.js

Can you try this?


As to WHAT is happening I think it looks for /protractor/protractor.conf_sanity.js while already in working directory... essentially under /protractor/protractor/protractor.conf_sanity.js . But no idea WHY it's happening

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM