i tried to generate reports by using "'protractor-jasmine2-html-reporter'", but i'm getting module not found exception with error code 5..i tried the somany solutions gathered from stack overflow, but it is not worked. can somebody please help me in this.
Config.js
var Jasmine2HtmlReporter=require('protractor-jasmine2-html-reporter');
exports.config = {
directConnect : true,
capabilities:{
'browserName':'chrome'
},
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['ProtractorTest/PageObjectMain.js'],
jasmineNodeOpts:{
defaultTimeoutInterval : 30000
},
onPreapre:function(){
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath:"./test-results/report"
}));
},
}
Error log
[14:54:53] E/configParser - Error code: 105
[14:54:53] E/configParser - Error message: failed loading configuration file ReportConfig.js
[14:54:53] E/configParser - Error: Cannot find module 'protractor-jasmine2-html-reporter'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (H:\workspace\Protractor_tutorials\ReportConfig.js:1:88)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
and my 'Package.Json' not have any details about the report files.. so if that is the problem, please help me to how to configure those in json file.
There are few things you have to make sure while using Protractor Reporters
1.in my case, in the time creating variable for reporter instead of directly passing Reporter name try to pass the full path of Reporter module.. may this will work
Eg :
var Jasmine2HtmlReporter=require('C:/......./npm-modules/protractor-jasmine2-html-reporter');
2.make sure you running the Correct Configuration file having .js extension.
Installing without save-devworked for me .
Installed globally
npm install -g protractor-jasmine2-html-reporter
Run below command to link protractor and jasmine2-html-reporter to aovid report not generating issue. Please see Girish Sortur's answer in How to create Protractor reports with Jasmine2
npm link protractor-jasmine2-html-reporter
Also add this import with path to exact node module to avoid the error in windows 10
var Jasmine2HtmlReporter = require('C:/Users/sam/AppData/Roaming/npm/node_modules/protractor-jasmine2-html-reporter');
Full conifg,js that worked for me in windows 10 as per below.
//protractor jasminreporterconfig.js
//Add this import with path to exact node module to avoid the error
var Jasmine2HtmlReporter = require('C:/Users/sam/AppData/Roaming/npm/node_modules/protractor-jasmine2-html-reporter');
exports.config = {
framework: 'jasmine',
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--start-maximized" ]
}
},
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
takeScreenshots: true,// By default this is enabled Default is true
takeScreenshotsOnlyOnFailures: false, // Default is false (So screenshots are always generated)
cleanDestination: true, // if false, will not delete the reports or screenshots before each test run.Default is true
showPassed: true,//default is true This option, if false, will show only failures.
fileName: 'MyRepoDemo', //We can give a prefered file name .
savePath: 'myproreports',//Reports location it will automatically generated
screenshotsFolder: 'screenshotsloc' //Screenshot location it will create a folder inside myproreports
})
);
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['src/com/sam/scriptjs/nonangularstackscript.js']
}
It looks like You haven't installed protractor-jasmine2-html-reporter
Go to folder where packages are installed (node_modules folder) and run:
npm install protractor-jasmine2-html-reporter
Try to check where the node_modules directory is present by running npm audit and which npm commands. The main thing is path where node_modules is installed should be traced and the new module like npm install protractor-jasmine2-html-reporter can be installed in that path
Related
I got this error on my M2 MacBook, running a project, that worked on my old Intel MacBook. Do you have any idea what the problem is?
I am using bun but npm run dev (node 18) gives me the same error.
The exact same error occurred on other projects.
Package.json dependencies:
"devDependencies": {
"#types/three": "^0.143.1",
"parcel": "^2.7.0"
},
"dependencies": {
"three": "^0.143.0"
}
Console output for bun run dev:
$ parcel src/index.html --open
Error: No native build was found for platform=darwin arch=x64 runtime=node abi=108 uv=1 libc=glibc node=18.7.0
loaded from: /Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/lmdb and package: #lmdb/lmdb-darwin-x64
at load.path (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/node-gyp-build-optional-packages/index.js:64:9)
at Object.load [as default] (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/node-gyp-build-optional-packages/index.js:20:30)
at Object.<anonymous> (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/lmdb/dist/index.cjs:47:47)
at Module._compile (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at _lmdb (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/#parcel/cache/lib/LMDBCache.js:61:39)
Script error "dev" exited with 1 status
Thanks in advance!
You can override a version using the override option in you package.json.
Read more about this option here: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
For me, the solution was to add this to my package.json:
"overrides": {
"lmdb": "2.6.0-alpha6",
"#lmdb/lmdb-darwin-arm64": "2.6.0-alpha6",
"#lmdb/lmdb-darwin-x64": "2.6.0-alpha6",
}
This feature is currently (Aug. 2022) not supported by bun!
Yarn does this using resolutions: https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions
So I tried using Babel to convert my code so that I can run this by node. package.json build is this,
"build": "babel ./public/src -d ./public/lib -w"
When I do npm run build
PS C:\users\leepc\babel\public> npm run build
> babel#1.0.0 build C:\users\leepc\babel
> babel ./public/src -d ./public/lib -w
public\src\blogpost.js -> public\lib\blogpost.js
public\src\main.js -> public\lib\main.js
public\src\publication.js -> public\lib\publication.js
It works right and shows me exactly what I want.
My .babelrc preset is es2015
I run my main.js code and this is happened.
PS C:\users\leepc\babel\public\lib> node main.js
internal/modules/cjs/loader.js:984
throw err;
^
at Function.Module._load
(internal/modules/cjs/loader.js:863:27)
at Module.require
(internal/modules/cjs/loader.js:1043:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous>
(C:\users\leepc\babel\public\lib\main.js:3:17)
at Module._compile
(internal/modules/cjs/loader.js:1157:30) 17)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:1177:
10)
at Module.load (internal/modules/cjs/loader.js:1001:32)
at Function.Module._load
(internal/modules/cjs/loader.js:900:14)
at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_m
ain.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\users\\leepc\\babel\\public\\lib\\main.js' ]
}
This is files and folders list in img
My codes are coverted well, but it still got some Module problems. How can I solve this issue? Sorry this is my first time posting question in this website, if I missed some information pls tell me.
edit:
Here is .babelrc
{
"presets": ["es2015"]
}
Okay it turns out, I should combine both of answers above.
First, I have to check whether my import plugin is right or wrong. So I just re-installed it.
npm install babel-plugin-import --save-dev
Make sure not to forget put plugin opitions. In my cases, I use this in .babelrc
{
"presets": ["es2015"],
"plugins": [["import", { "libraryName": "antd" }]]
}
this "plugins": [["import", { "libraryName": "antd" }] line means import js modulary.
And also next stuff, I have to make import path to be corrected.
import { create as newBlogPost } from "blogpost.js";
change this to
import { create as newBlogPost } from "./blogpost.js";
By doing this, now I can get a result that I wanted so far.
PS C:\Users\leePC\babel\public\lib> node main.js
Title: For and against let
By: Kyle Simpson
October 27, 2014
So majorly, 1. Check whether I missed some plugins or packages ( in my cases, I forgot import package ) 2. Make sure to check your import path
Thank you for help guys.
I have a project which I am building locally with Gulp.js. But when I push it to GitHub and Travis start building it. I get the following error:
module.js:338
throw err;
^
Error: Cannot find module 'gulp-concat'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/travis/build/thyagostall/freecell/gulpfile.js:4:11)
at Module._compile (module.js:460:26)
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)
The .travis.yml:
language: node_js
node_js:
- "0.12"
before_script:
- npm install -g gulp gulp-concat gulp-connect gulp-html-replace gulp-eslint
script: gulp
Also my gulpfile.js:
var gulp = require('gulp'),
connect = require('gulp-connect'),
concat = require('gulp-concat'),
htmlreplace = require('gulp-html-replace');
var distDir = './build/',
sourceDir = './src/';
gulp.task('webserver', function() {
connect.server({
root: distDir,
port: 2345,
livereload: true
});
gulp.watch('src/**/*.*', ['build', 'images', 'styles', 'vendor']);
});
gulp.task('images', function() {
gulp.src(sourceDir + '**/*.{jpg,png,gif}')
.pipe(gulp.dest(distDir));
});
gulp.task('styles', function() {
gulp.src(sourceDir + '**/*.css')
.pipe(gulp.dest(distDir));
});
gulp.task('build', function() {
gulp.src([sourceDir + '**/utility.js', sourceDir + '**/game_events.js', sourceDir + '**/memento.js', sourceDir + '**/*.js'])
.pipe(concat('main.js'))
.pipe(gulp.dest(distDir))
.pipe(connect.reload());
});
gulp.task('vendor', function() {
gulp.src(sourceDir + '**/*.html')
.pipe(htmlreplace({
'vendor': 'vendor.js',
'js': 'main.js'
}))
.pipe(gulp.dest(distDir));
});
gulp.task('lint', function() {
gulp.src(sourceDir + '**/*.js')
.pipe(eslint())
.pipe(eslint.format())
});
gulp.task('default', ['build', 'images', 'styles', 'vendor']);
Is there any obvious thing I am missing?
First, change your .travis.yml to this:
language: node_js
node_js:
- "0.12"
before_script:
- npm install -g gulp
script: gulp
You only need to install gulp globally because this provides the gulp commmand line tool. Per the official npm documentation:
There are two ways to install npm packages: locally or globally. You choose which kind of installation to use based on how you want to use the package.
If you want to use it as a command line tool, something like the grunt CLI, then you want to install it globally. On the other hand, if you want to depend on the package from your own module using something like Node's require, then you want to install locally.
Second, I did some sleuthing on your github account (linked from your StackOverflow profile) and found the project you're trying to build. Looking at the package.json I see that there is no gulp-concat among the devDependencies. This is probably due to typing:
npm install gulp-concat
instead of:
npm install gulp-concat --save-dev
Which would explain why you can build the project locally, but it fails on Travis-CI. Adding the gulp-concat to yourdevDependencies should resolve the issue.
This is my config.js file -
//server config information
var serverConfig=require('./serverConfig.js').serverConfig;
var $browser= serverConfig.$browser;
//got the browser name
process.argv.forEach(function (val, index) {
if(val==='-browser'){
$browser=process.argv[index+1];
}
});
// !!! update the server config
serverConfig.$browser= $browser;
//config
//browser.driver.manage().timeouts().setScriptTimeout(TIME_OUT);
// The main suite of Protractor tests.
exports.config = {
seleniumServerJar: '../../selenium/selenium-server-standalone-2.37.0.jar',
chromeDriver: '../../selenium/chromedriver.exe',
seleniumAddress: serverConfig.SELENIUMN_ADDRESS,
// Spec patterns are relative to this directory.
specs: [
'../e2e/Regression/CreateOperatorViewFromViewManagement.js'
],
capabilities: {
'browserName': $browser
},
onPrepare:'../prepareStartup.js',
//When the angular bootstrap not from the <html></html>
rootElement: 'body>div',
baseUrl: serverConfig.BASE_URL
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
}
};
I get this error when I try to execute my tests using this config.js file -
C:\TRUNK\tests\func\gui\protractor\config\protractorConfig.js:60
jasmineNodeOpts: {
^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
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 ConfigParser.addFileConfig (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\configParser.js:139:20)
at Object.init (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\launcher.js:59:7)
at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\cli.js:118:23)
at Module._compile (module.js:456:26)
When I execute protractor --help I get following options -
Options:
--help Print Protractor help menu
--version Print Protractor version
--browser, --capabilities.browserName Browsername, e.g. chrome or firefox
--seleniumAddress A running seleium address to use
--seleniumServerJar Location of the standalone selenium jar file
--seleniumPort Optional port for the selenium standalone ser
--baseUrl URL to prepend to all relative paths
--rootElement Element housing ng-app, if not html or body
--specs Comma-separated list of files to test
--exclude Comma-separated list of files to exclude
--verbose, --jasmineNodeOpts.isVerbose Print full spec names
--stackTrace, --jasmineNodeOpts.includeStackTrace Print stack trace on error
--params Param object to be passed to the tests
--framework Test framework to use. jasmine or mocha.
Please suggest what mistake I'm making in the config file or do I need to configure some more things.
You forgot a comma at the end of baseUrl: serverConfig.BASE_URL ;)
It should be:
baseUrl: serverConfig.BASE_URL,
I am currently working on an express.js Webapp, Im working off the boilerplate app that comes with MS Webmatrix. I am able to run the app on my computer but when i push to nodejitsu or use another computer from which i got the app from git i get an error preventing server start.
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] })
^
TypeError: Object function createApplication() {
var app = connect();
utils.merge(app, proto);
app.request = { __proto__: req };
app.response = { __proto__: res };
app.init();
return app;
} has no method 'compiler'
at Function.<anonymous> (C:\Users\hoopdog2\Desktop\afterthoughts_nodejs\serv
er.js:197:21)
at Function.app.configure (C:\Users\hoopdog2\Desktop\afterthoughts_nodejs\no
de_modules\express\lib\application.js:399:61)
at Object.<anonymous> (C:\Users\hoopdog2\Desktop\afterthoughts_nodejs\server
.js:188:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
The dependencies that that app uses are
"node-uuid": ">= 1.3.3",
"everyauth": ">= 0.2.29",
"nconf": ">= 0.5.1",
"express": ">= 2.5.0",
"jade": ">= 0.18.0",
"less": ">= 1.1.5",
"socket.io": ">= 0.8.7",
"connect": ">=1.8.5",
"recaptcha": ">=1.1.0"
And i am using node version 0.8.7. Any suggestions to what might be causing this error is greatly appreciated
The compiler middleware for Express comes from the Connect framework and as of Jul 2011 Connect no longer includes compiler. So doing express.compiler(...) doesn't work anymore.
A LESS-specific middleware has been created and Express now uses that if you include it in your startup config. express -c less will add this line to the config:
app.use(require('less-middleware')({ src: __dirname + '/public' }));
If you have an older version of Express and Connect, you can add less-middleware to your package.json and add the line above to get it working.
It works pretty much the same as the original compiler, but includes some more bells and whistles.
less-middleware project repository
Thanks to Hector i resolved the issue. I had the wrong version of express installed and changing express to = 2.5.0 from >=2.5.0 and reinstalling dependencies has fixed the issue and i am now able to run the app. Thanks