Unable to run grunt-karma - node.js

I am trying to use grunt-karma (https://www.npmjs.org/package/grunt-karma) with this config:
karma:
unit:
runnerPort: 9999
singleRun: true
browsers: ['PhantomJS']
logLevel: 'ERROR'
background: true
files: [JASMINE, JASMINE_ADAPTER, 'test/server/*.js']
The gruntfile is written in coffeescript. Here is the error I'm getting:
>grunt karma:unit
Loading "Gruntfile.coffee" tasks...ERROR
>> ReferenceError: JASMINE is not defined
Warning: Task "karma:unit" not found. Use --force to continue.
Aborted due to warnings.
The configuration sample (on the npm page linked to above)does not show any requirements to define JASMINE, so I'm confused what it is that I am not doing right.
Please help me fix this.
(Additionally, can you advise me of alternative ways to test nodejs + expressjs projects using grunt and jasmine)

Related

Laravel Mix: ValidationError: CSS Loader has been initialized using an options object that does not match the API schema

I recently tried to run npm run dev and also npm run watch, but I got an error after 80% got compiled. I tried googling it but didn't find the solution to it. Below is the error which I get in my console.
ERROR in ./resources/sass/frontend/app.scss Module build failed (from
./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from
./node_modules/css-loader/dist/cjs.js): ValidationError: Invalid
options object. CSS Loader has been initialized using an options
object that does not match the AP I schema.
options.url should be one of these: boolean | object { filter? } -> Allows to enables/disables url()/image-set() functions handling. -> Read more at
https://github.com/webpack-contrib/css-loader#url Details:
options.url should be a boolean.
options.url should be an object:
object { filter? }
at validate (E:\Web Projects\project\node_modules\webpack\node_modules\schema-utils\dist\validate.js:105:11)
at Object.getOptions (E:\Web Projects\project\node_modules\webpack\lib\NormalModule.js:527:19)
at Object.loader (E:\Web Projects\project\node_modules\css-loader\dist\index.js:31:27)
at processResult (E:\Web Projects\project\node_modules\webpack\lib\NormalModule.js:701:19)
at E:\Web Projects\project\node_modules\webpack\lib\NormalModule.js:807:5
at E:\Web Projects\project\node_modules\loader-runner\lib\LoaderRunner.js:399:11
at E:\Web Projects\project\node_modules\loader-runner\lib\LoaderRunner.js:251:18
webpack.mix.js
const mix = require('laravel-mix');
mix.setPublicPath('public')
.setResourceRoot('../')
.vue()
.sass('resources/sass/frontend/app.scss', 'css/frontend.css')
.sass('resources/sass/backend/app.scss', 'css/backend.css')
.js('resources/js/frontend/app.js', 'js/frontend.js')
.js([
'resources/js/backend/before.js',
'resources/js/backend/app.js',
'resources/js/backend/after.js'
], 'js/backend.js')
.js('resources/js/global.js', 'js/global.js')
.js('resources/js/Banners/banner.js', 'js/banner.js')
.extract([
// Extract packages from node_modules to vendor.js
'alpinejs',
'jquery',
'bootstrap',
'popper.js',
'axios',
'sweetalert2',
'lodash'
])
.sourceMaps();
if (mix.inProduction()) {
mix.version();
} else {
// Uses inline source-maps on development
mix.webpackConfig({
loader: 'url-loader',
devtool: 'inline-source-map'
});
}
Both Frontend.scss & Backend.scss are not getting compiled or mixed and throws up an error given above. When I tried to comment it, it ran properly as expected, but without commenting it, it doesn't. I don't know where I am going wrong here. I also tried to run npm rebuild node-sass and then again tried to run npm run prod, npm run dev & npm run watch, but none worked.
As a workaround, downgrade your css-loader package to a 5.x version.
npm install css-loader#5.2.7 --save-dev

npm start (or yarn start) error with babel when creating react applications

I am trying this article working on a react calculator
I set my package.json with "start": "babel-node ./server/server.js" in the scripts. When I run npm start, errors shows up. yarn start gives more details error message shown there.
max#DESKTOP-4J1U771 MINGW64 ~/Documents/react-calculator (master) $
yarn start yarn run v1.7.0 warning package.json: No license field $
babel-node ./server/server.js
C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\logger.js:41
throw new Constructor(this._buildMessage(msg));
^
ReferenceError: [BABEL]
C:\Users\max\Documents\react-calculator\server\server.js: Unknown
option: base.0. Check out h ttp://babeljs.io/docs/usage/options/ for
more information about options.
A common cause of this error is the presence of a configuration
options object without the corresponding preset name. Example:
Invalid: { presets: [{option: value}] } Valid: { presets:
[['presetName', {option: value}]] }
For more detailed information on preset configuration, please see
https://babeljs.io/docs/en/plugins#pluginpresets-op tions.
at Logger.error (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\logger.j
s:41:11)
at OptionManager.mergeOptions (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation
\file\options\option-manager.js:226:20)
at OptionManager.init (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\op
tions\option-manager.js:368:12)
at File.initOptions (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\inde
x.js:212:65)
at new File (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\index.js:135
:24)
at Pipeline.transform (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\pipelin
e.js:46:16)
at Object.transformFileSync (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\api\node.js:152:
10)
at compile (C:\Users\max\Documents\react-calculator\node_modules\babel-register\lib\node.js:118:20)
at loader (C:\Users\max\Documents\react-calculator\node_modules\babel-register\lib\node.js:144:14)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\max\Documents\react-calculator\node_modules\
babel-register\lib\node.js:154:7) error Command failed with exit code
1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this > command.
Does anyone see what's going on here and how to solve it?
Use create-react-app. It is way simpler than configuring babel and creating React projects the old way. To use it, go to the directory you want your project to be in, and type in your terminal: create-react-app [project-name]. This will do all the configuring for you and make it easier for you. The installation and configuration of React mentioned in the article is outdated, but you can still follow everything else in that tutorial. Good luck!

grunt task uglify errors >> TypeError: Object #<Object> has no method 'isAbsolute'

I am running grunt cssmin it shows error
>> TypeError: Object #<Object> has no method 'isAbsolute'
Warning: CSS minification failed at node_modules/bootstrap/dist/css/bootstrap.mi
n.css. Use --force to continue.
Aborted due to warnings.
:
grunt_default F
AILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':grunt_default'.
> Process 'command 'C:...\nodejs\node-v0.10.22-windows-x64\bin\node.exe'' finished with non-zero exit value 6
Grunt Code part is given below.
cssmin:{
main:{
files:[{
expand: true,
cwd: 'node_modules/bootstrap/dist/css',
src: '**/bootstrap.min.css',
dest: 'css'
},{
expand: true,
cwd: 'node_modules/angular-ui-grid',
src: '**/ui-grid.min.css',
dest: 'css'
}]
}
},
Node version is 6.1.0 and npm version is 5.0.4
The grunt css min version is "grunt-contrib-cssmin": "^2.2.0"
I have seen similar errors and most of the answers are to upgrade the node version to 4 or more. My node version is 6.1.0. Any help would be great. Thanks...
Path.isAbsolute was added in node v0.11.2
From your log it looks like you are still using Node v0.10.22
Process 'command 'C:...\nodejs\node-v0.10.22-windows-x64\bin\node.exe'
Double check your environment variables and update your path to point to the new v6.1.0 node \bin folder.
Remove the old v0.10.22 version if you are no longer using it.

Editing keystone.js in anyway at all results in jshint "Path must be a string" + Aborted due to warnings

After generating a 'yo keystone' build, I started following this tutorial:
http://www.tutorialindustry.com/keystonejs-cms-tutorial-for-beginners
And I tried changing the favicon path from public/favicon.ico to public/images/favicon.ico and jshint throws:
>> File "keystone.js" changed.
Running "jshint:server" (jshint) task
Warning: Path must be a string. Received { toString: [Function], reporter: [Function] } Use --force to continue.
Aborted due to warnings.
I tried stepping back to undue my change and everytime, grunt watch yields the same error. I'm a newb at the node stack and still figuring out how all the pieces go together and have searched and searched for a solution to this, so any help is hugely appreciated.

Aurelia bundle: error loading "aurelia-cli"

When I run aurelia's bundler I get the following error:
D:\Code\Test>aurelia bundle
info: Using Aureliafile: D:\Code\Test\aureliafile.js
info: Creating bundle ...
Potentially unhandled rejection [6] Error: Error loading "aurelia-cli" at file:D:/Code/Test/aurelia-cli.js
Error loading "aurelia-cli" from "aureliafile" at file:D:/Code/Test/aureliafile.js
ENOENT, open 'D:\Code\Test\aurelia-cli.js'
at Error (native)
The problem is a combination of having set "*" : "*.js" in System.Config and using the "*" wildcard telling aurelia bundle to pull in everything. This turns out to try to include the project root files. You can either be more specific to the bundler:
aureliafile.js:
"dist/app-bundle": {
modules: [
'dist/*',
...
or reapply the jspm mapping "*" : "dist/*.js". Unfortunatly what I need is actually one configuration during development (bundling) and another during production (serving).
related issues:
https://github.com/aurelia/cli/issues/112
https://github.com/aurelia/cli/issues/116

Resources