I am trying to run a js scripts using protractor, but i am getting following error
C:\Users\Hoodi\AppData\Roaming\npm\node_modules\protractor\built\cli.js:172
throw new Error('Found extra flags: ' + unknownKeys.join(', '));
^
Error: Found extra flags: identityManagement
at Object.<anonymous> (C:\Users\Hoodi\AppData\Roaming\npm\node_modules\protractor\built\cli.js:172:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Hoodi\AppData\Roaming\npm\node_modules\protractor\bin\protractor:5:1)
at Module._compile (module.js:570:32)
My config file
// conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
useAllAngular2AppRoots: true,
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
// Use colors in the command line report.
showColors: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 60000,
},
onPrepare: function() {
require('../../lib/waitReady.js');
},
capabilities :{
browserName : 'chrome',
}
}
console.dir("argv: " + process.argv)
switch(process.argv[3]) {
case '--identityManagement':
exports.config.specs = ['./identityManagement.js'];
break;
default:
exports.config.specs = ['./identityManagement.js'];
}
I tried executing above script using protractor as well as "npm run" command, but in both cases i am getting same error. command that i used
protractor ./conf.js --identityManagement
and
npm run im
This actually works on my other system. npm and node version of system where this works are
node v7.2.1
npm v3.10.10
And where is doesnt work
node v7.4.0
npm v4.0.5
My package.json file looks like this
{
"name": "intelliflash",
"author": "Vishwanath Rawat <rawat#tegile.com>",
"description": "IntelliFlash tests",
"scripts": {
"im": "protractor ./conf.js --identityManagement"
}
}
Please help.
It has nothing to do with your npm or node versions, Latest release of Protractor 5.0 has put a check in cli for unidentified flags as you are putting with the help of process.argv.
You can solve this by disabling the flag checks:
protractor ./conf.js --identityManagement --disableChecks
For more details please refer the Protractor 5.0 changelog
Note: min node version now is v6.9.x which supports this version of protractor
Related
With svgo 1.3.2 I used to run this command :
svgo --pretty --disable={removeUnusedNS,removeUselessDefs,removeUselessStrokeAndFill} file.svg -o file.min.svg
I updated to svgo 2.3.0 and now I get :
error: unknown option '--disable={removeUnusedNS,removeUselessDefs,removeUselessStrokeAndFill}'
So I tried to create a svgo.config.js like this :
const { extendDefaultPlugins } = require('svgo');
module.exports = {
plugins: extendDefaultPlugins([
{
name: 'removeUnusedNS',
active: false
},
{
name: 'removeUselessDefs',
active: false
},
{
name: 'removeUselessStrokeAndFill',
active: false
}
])
}
but I just get the error :
Error: Cannot find module 'svgo'
Require stack:
C:\Users\jpprade\Documents\vrac\svgo.config.js
C:\Users\jpprade\AppData\Roaming\npm\node_modules\svgo\lib\svgo-node.js
C:\Users\jpprade\AppData\Roaming\npm\node_modules\svgo\lib\svgo\coa.js
C:\Users\jpprade\AppData\Roaming\npm\node_modules\svgo\bin\svgo
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (C:\Users\jpprade\Documents\vrac\svgo.config.js:1:34)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
svgo is install (globaly)
How can I run svgo with those 3 plugins disabled using to config file (or not) ?
Thanks !
What is the output when you run svgo -v?
It is possible that you are inside a project that has an older version as a dependency which takes precedence over the global svgo package.
You can try require using the absolute path to svgo 2.3.0.
For instance mine was like that require('/home/nili/.nvm/versions/node/v14.16.1/lib/node_modules/svgo');
I think it could also be in /usr/local/lib/node_modules/svgo if you installed it as root.
Mosca gives this error:
TypeError: Client is not a constructor
at new KafkaAscoltatore (/home/x/Desktop/broker/node_modules/mosca/node_modules/ascoltatori/lib/kafka_ascoltatore.js:59:26)
at Object.build (/home/x/Desktop/broker/node_modules/mosca/node_modules/ascoltatori/lib/ascoltatori.js:77:12)
at /home/x/Desktop/broker/node_modules/mosca/lib/server.js:181:40
at makeCall (/home/x/Desktop/broker/node_modules/fastseries/series.js:117:7)
at ResultsHolder.release (/home/x/Desktop/broker/node_modules/fastseries/series.js:96:9)
at series (/home/x/Desktop/broker/node_modules/fastseries/series.js:39:14)
at Object.series (/home/x/Desktop/broker/node_modules/steed/steed.js:90:7)
at new Server (/home/x/Desktop/broker/node_modules/mosca/lib/server.js:171:9)
at Object.<anonymous> (/home/x/Desktop/broker/broker.js:118:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
Environment
Node version:v10.9.0
Kafka-node version:latest
Mosca version:latest
What I have tried
I opened /home/x/Desktop/broker/node_modules/mosca/node_modules/ascoltatori/lib/kafka_ascoltatore.js
and after looking at the line below found out that the problem is related with kafka-node version:
this._opts.kafka = this._opts.kafka || require("kafka-node");
When I removed this._opts.kafka, it started to work fine. Then I printed both I figured out that the new version does not have Client constructor in it. Here is my print result:
this._opts.kafka (kafka-node v4.0.1 latest) returns HighLevelProducer which does not have Client, on the other hand require("kafka-node") (v0.5.9) returns HighLevelConsumer.
Code:
var backend = {
type: "kafka",
kafka: require('kafka-node'),
json: false,
connectionString: "IP:2181",
defaultEncoding: "utf8",
};
var moscaSettings = {
interfaces: [
{ type: "mqtt", port: PORT }
],
id: "mosca",
stats: false,
publishNewClient: false,
publishClientDisconnect: false,
publishSubscriptions: false,
backend: backend,
};
var server = new mosca.Server(moscaSettings); // Error pops here
I could make Kafka to work with older version as I mentioned above, but I think it would be only a quick fix, so I hope somebody can lead me with a proper solution.
The problem resulted from my using an example from the old version of kafka-node. When I replaced the code with the new example from the kafka-node GitHub, the problem was resolved.
the very simple example below (pretty much copied off the npm inquirer front page) is giving the ".then is not a function" error. However I can't figure out what the issue is.
var inquirer = require('inquirer');
inquirer.prompt([
{
name: 'my_name',
type: 'input',
message: 'What is your name: '
}]).then(answers => {
console.log("Your name is:"+answers.my_name)
});
The error message looks like this:
? What is your name:
/home/peter/Documents/nodejs.d/vscode_examples_workspace/security/inq.js:8
}]).then(answers => {
^
TypeError: inquirer.prompt(...).then is not a function
at Object.<anonymous> (/home/peter/Documents/nodejs.d/vscode_examples_workspace/security/inq.js:8:13)
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)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
But the following example works OK. So the basic node.js environment (nodejs --version = v9.11.2) is OK.
var inquirer = require('inquirer');
let q = [
{
name: 'my_name',
type: 'input',
message: 'What is your name: '
}];
inquirer.prompt (q, function (answers){
console.log("Your name is: "+answers.my_name);
});
// Output
$ nodejs inq.js
? What is your name: Peter
Your name is: Peter
This is probably because you have an old version of inquirer (0.12.0 or older) which does not support promises (promises were added in version 1.0.0).
Your snippet works fine with version 6.0.0 and 1.0.0 but fails with the exact same error message in version 0.12.0.
Check packages.json for your version and update it:
"dependencies": {
"inquirer": "^6.0.0"
}
Then do
npm install
I'm just getting started with gulp in a .NET 4.6 project and I'm getting the error "Failed to load" in task runner explorer. My gulpfile is:
var gulp = require('gulp');
var inject = require('gulp-inject');
var concat = require('gulp-concat');
var print = require('gulp-print');
gulp.task('default', function () {
console.log('Hello Gulp!');
});
gulp.task('css-task', function () {
var target = gulp.src('./index.html');
var customCssStream = gulp.src(['./bower_components/bootstrap/dist/css/bootstrap.min.css']);
return target
.pipe(inject(customCssStream.pipe(print())
.pipe(concat('appStyles.css'))
.pipe(gulp.dest('./Content/css')), { name: 'styles' }))
.pipe(gulp.dest('./'));
});
And the error is:
gulp-inject/src/inject/index.js:127 startTag, ^ SyntaxError:
Unexpected token , at exports.runInThisContext (vm.js:73:16) at
Module._compile (module.js:443:25) at Object.Module._extensions..js
(module.js:478:10) at Module.load (module.js:355:32) at
Function.Module._load (module.js:310:12) at Module.require
(module.js:365:17) at require (module.js:384:17) at Object.
(.../node_modules/gulp-inject/index.js:4:28) at Module._compile
(module.js:460:26) at Object.Module._extensions..js (module.js:478:10)
I was able to get the "Hello Gulp!" task to run, but once I add gulp-inject I see the problem.
Turns out the problem was related to the version of node.js that Visual Studio 2015 installed not being compatible with node-inject module. After I installed version 4.4.2 of node.js and pointed visual studio at it as described here it now compiles.
Gruntfile.js
module.exports = functions(grunt)
{
grunt.initConfig({
//pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';',
},
dist: {
src: ['APIdocu/AccountsCollection.md', 'APIdocu/AccountsFollowersCollection.md'],
dest: 'APIdocu/ConcatApis.md',
//files: {
//'APIdocu/NewApi.md' : ['APIdocu/AccountsCollection.md', 'APIdocu/AccountsFollowersCollection.md']
},
},
});
grunt.loadNpmTasks('grunt-contrib-concat');
//tasks
grunt.registerTask('default', ["concat"]);
}
error message
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Loading "Gruntfile.js" tasks...ERROR
ReferenceError: grunt is not defined
at Object.<anonymous> (C:\Users\gs1460\Desktop\Markdownfiles\apis\Gruntfile.js:1:90)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at loadTask (C:\Users\gs1460Desktop\Markdownfiles\apis\node_modules\grunt\lib\grunt\task.js:323:10)
at Task.task.init (C:\Users\gs1460\Desktop\Markdownfiles\apis\node_modules\grunt\lib\grunt\task.js:437:5)
at Object.grunt.tasks (C:\Users\gs1460\Desktop\Markdownfiles\apis\node_modules\grunt\lib\grunt.js:120:8)
at Object.module.exports [as cli] (C:\Users\gs1460\Desktop\Markdownfiles\apis\node_modules\grunt\lib\grunt\cli.js:38:9)
Running tasks: concat:dist
Warning: Task "concat:dist" not found. Use --force to continue.
Aborted due to warnings.
How do I get rid of this error.
I need to concatenate md files to one.It gives me the above error. Tried changing the code many times. But same issue. Can you help in this.
Probably the problem is that you are writting functions instead of function.
Check also if the variable grunt is in the correct scope. And please use tabs correctly!
module.exports = function(grunt)
Regards.