Catcher Error 105 when trying to run spec.js

My protractor worked fine, and when it was updated, it could not open a simple specifications file, it always throws this error. I was looking for a solution, but could not find one of the conf and spec files, which are examples from the protractor site itself. I am inserting an error below, hope you could help. Thank you in advance

conf.js error

[09:10:06] E/configParser - error code: 105 [09:10:06] E/configParser - description: failed loading configuration file spec.js C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130 throw new exitCodes_1.ConfigError(logger, 'failed loading configurat ion file ' + filename); ^ Error at ConfigError.ProtractorError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:10:22) at new ConfigError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:26:16) at ConfigParser.addFileConfig (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130:19) at Object.initFn [as init] (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\launcher.js:94:22) at Object.<anonymous> (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\cli.js:130:10) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) 

Conf and spec files are examples from the site.

conf.js:

 exports.config = { framework: 'jasmine', seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'] } 

spec.js

 describe('Protractor Demo App', function() { it('should have a title', function() { browser.get('http://juliemr.imtqy.com/protractor-demo/'); expect(browser.getTitle()).toEqual('Super Calculator'); }); }); 
+6
source share
6 answers

In @jtzero's note, the problem is that the configuration parser is masking the actual error message when loading the configuration file.

Depending on whether you run Protractor as a global one or from a folder, open ( C:\Users\y\AppData\Roaming\npm\ ) node_modules\protractor\built\configParser.js on line 13 0. There you can add logger.error(e); eg:

  /** * Public function specialized towards merging in a file config * * @public * @param {String} filename */ ConfigParser.prototype.addFileConfig = function (filename) { if (!filename) { return this; } var filePath = path.resolve(process.cwd(), filename); var fileConfig; try { fileConfig = require(filePath).config; } catch (e) { logger.error(e); throw new exitCodes_1.ConfigError(logger, 'failed loading configuration file ' + filename); } if (!fileConfig) { throw new exitCodes_1.ConfigError(logger, 'configuration file ' + filename + ' did not export a config object'); } fileConfig.configDir = path.dirname(filePath); this.addConfig_(fileConfig, fileConfig.configDir); return this; }; 

Then an error will be reported on the output. In my case, it was an unsuccessful call to require() :

 [10:36:29] E/configParser - { [Error: Cannot find module 'phantomjs'] code: 'MODULE_NOT_FOUND' } 

Reorganized GitHub issue # 3301: https://github.com/angular/protractor/issues/3301

Update
Protractor 4.0 will provide a fix for this problem to report a hidden error message with a stack trace.

+10
source

You should run the conf.js file, not the spec.js.

It looks like you are running the protractor spec.js command when it should be protractor conf.js. The error says that it is looking for a configuration file, but you are passing it a specification file.

+3
source

Passing the correct path to the conf.js file might be the solution. Try changing to the folder where you have this file, and then run the command again.

Of course, specify the conf.js file, not the specification.

+2
source

I fixed this by reinstalling the idea of ​​how and what the problem is

0
source

I had the same problem (with a different error code), and I fixed the addition of the java path to the environment variables (the SDK installer did not configure it automatically).

0
source

I got this error because the contents of conf.js invalid.
I incorrectly used seleniumAddress= "http://localhost:4444/wd/hub" instead of seleniumAddress: "http://localhost:4444/wd/hub" (using equal = instead of a colon : .

(Error 105 - Issue with the conf.js)

After changing conf.js everything works fine,

 exports.config = { seleniumAddress: "http://localhost:4444/wd/hub", specs: ['spec.js'], capabilities:{'browserName': 'chrome'}, onPrepare(){ browser.driver.manage().window().maximize(); }, onComplete(){ }, }; 
0
source

All Articles