cssnext not write file - node.js

I run cssnext (1.3.0) with gulp (3.8.11) on docker (1.6) container (official node image) and my OS is ArchLinux (host). The node version is 0.10.38. I have a problem, i can't solve. This is my gulpfile.js:
var gulp = require('gulp');
var cssnext = require("gulp-cssnext");
gulp.task("css4Tocss", function() {
gulp.src("css/index.css")
.pipe(cssnext({
compress: true
}))
.pipe(gulp.dest("dist"))
});
When i run:
gulp css4Tocss
i get the following error:
events.js:72
throw er; // Unhandled 'error' event
^
TypeError: undefined is not a function
at LazyResult.run (/app/node_modules/cssnext/node_modules/postcss/lib/lazy-result.js:193:24)
at LazyResult.sync (/app/node_modules/cssnext/node_modules/postcss/lib/lazy-result.js:179:32)
at LazyResult.stringify (/app/node_modules/cssnext/node_modules/postcss/lib/lazy-result.js:210:14)
at LazyResult._createClass.get (/app/node_modules/cssnext/node_modules/postcss/lib/lazy-result.js:232:25)
at cssnext (/app/node_modules/cssnext/index.js:220:20)
If you have an idea, i'm interested ^^.

Looks like there's an issue in the latest version of this module. Downgrading to "gulp-cssnext": "0.6.0" fixed this issue for me.
Either that or you can follow the issue above!

Related

Random occurrences of Failed: ECONNREFUSED connect ECONNREFUSED 127.0.0.1 when running protractor tests

My protractor test cases randomly fail with this error message:
Failed: ECONNREFUSED connect ECONNREFUSED 127.0.0.1
I have gone through the resources and tried all the suggested solutions:
Upgraded protractor
Ran webdriver-manager update
Upgraded chromedriver version but the issue seems to exist.
This particularly happens when I try to run all the e2e tests together.
Below is the specific versions that Im using for my project:
node - v9.2.0
protractor - Version 5.4.1
ChromeDriver 2.42.591088
Please help.
Thanks,
Neeraja
Are you using async/await in your tests?
Can you try applying patch as specified below from the same folder which contains the 'node_modules' folder by executing 'node patch.js'?
patch.js file
var fs = require('fs');
var httpIndexFile = 'node_modules/selenium-webdriver/http/index.js';
fs.readFile(httpIndexFile, 'utf8', function (err, data) {
if (err)
throw err;
var result = data.replace(/\(e.code === 'ECONNRESET'\)/g, "(e.code === 'ECONNRESET' || e.code === 'ECONNREFUSED')");
console.log(`Patching ${httpIndexFile}`)
fs.writeFileSync(httpIndexFile, result, 'utf8');});
var chromeFile = 'node_modules/selenium-webdriver/chrome.js';
fs.readFile(chromeFile, 'utf8', function (err, data) {
if (err)
throw err;
var result = data.replace(/new http.HttpClient\(url\)/g, "new http.HttpClient(url, new (require('http').Agent)({ keepAlive: true }))");
console.log(`Patching ${chromeFile}`)
fs.writeFileSync(chromeFile, result, 'utf8');});
Please see original post here -
https://github.com/angular/protractor/issues/4706#issuecomment-393004887

Impossible to install spookyjs

I want to install spookyjs and find it impossible to do so. I've tried three different ways:
Run the standard spookyjs package.json provided in spookyjs github.
Then I try to run hello.js and I am greeted with this error.
C:\Users\User1\Desktop\test2>node hello.js
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn casperjs ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Installed phantomjs and casperjs globally and package.json installed spooky and tiny-jsonrpc. I get the same error message.
Installed these dependencies from package.json
"dependencies": {
"spooky": "^0.2.5",
"tiny-jsonrpc": "^2.0.1",
"phantom": "^4.0.12",
"casperjs": "^1.1.4"
I get the same error.
I came across this link:
Issue
and it detailed the solution. That is this chunk of code:
const
path = require('path'),
_ = require('underscore')
;
var
// close env to pass to spawn
env = _.clone(process.env),
// get the PATH - in my local Windows, it was Path
envPath = env.PATH || env.Path,
// get path to node_modules folder where casperjs and
// phantomjs-prebuilt are installed
// this will be different for you
binDir = path.join(__dirname, './../../node_modules/.bin'),
Spooky = require('spooky')
;
// update the path in the cloned env
env.PATH = env.Path = `${envPath};${binDir}`;
var spooky = new Spooky({
child: {
// spooky is trying to call casperjs.bat for windows
// .bat doesn't work, so call the update .cmd file
// this fixes issue 2 with the file
command: /^win/.test(process.platform) ? 'casperjs.cmd' : 'casperjs',
transport: 'http' ,
spawnOptions: {
// set the env using cloned version
// this fixes issue 1 with the path
env: env
}
},
...
So now the program runs without an error. Actually though it runs without anything, because while on the one hand no error pops up, on the other nothing pops up. I debbuged by putting console.log() inside spooky's callback function but nothing is displayed. That is for another question though...
But the error i was receiving has vanished and the interpreter runs the code.

"Error: spawn /usr/bin/compass ENOENT" when using gulp-compass

I'm attempting to run the following Gulp task to compile Sass files, using the plugin, gulp-compass on OS X Yosemite 10.5.5.
var path = require("path");
var gulp = require("gulp");
var compass = require("gulp-compass");
gulp.task("compile2013Base", function() {
var projectPath = path.join(__dirname, '../../ ');
gulp.src(['../sass/desktop/css/2013/*.scss']).pipe(compass({
project: projectPath,
css: 'htdocs/assets/css/2013/',
sass: 'sass/desktop/css/2013'
})).on('error', errorHandler).pipe(gulp.dest('../../htdocs/assets/css/2013/'));
});
function errorHandler (error) {
console.log(error.toString());
this.emit('end');
}
However, when I try to run the task like gulp compile2013Base, I get the following error:
> gulp compile2013Base
[13:39:06] Using gulpfile [**redacted**]/scripts/js/gulpfile.js
[13:39:06] Starting 'compile2013Base'...
[13:39:06] Finished 'compile2013Base' after 9.07 ms
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn /usr/bin/compass ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
I already have compass installed at /usr/bin/compass, and running compass in the terminal does not show any errors.
I'm not sure what to go on here, how do I get the error details?
This is helped me
sudo gem install -n /usr/local/bin compass
see Error: "compass:dist" Fatal error: spawn /usr/bin/compass ENOENT

node errors when running gulp del task

I cannot figure out why I am getting a node ENOENT error, when running a simple task to clean out my vendor files.
My gulp task looks like this
var gulp = require('gulp');
var del = require('del');
module.exports = function(opt){
gulp.task('clean:vendor', function(cb){
return del(['src/vendor/'],cb)
});
}
When I run the command gulp clean:vendor against a file structure that looks like this:
gulpfile.js
src/vendor/js
src/vendor/css
I get this error from node, and I cannot figure out how to catch or fix.
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open '/Users/aycollin/seed/src/vendor/js/bootstrap.js'

Nodejs GM module ImageMagick - strange Error

I have a very strange error. I'm using MAC OS X 10.9.5.
When i use some functions from GM (npm install gm) like resize or something else i got this error.
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
I have found many threads about it and according to them i have installed graphicksmagic and imagemagick with brew to system.
brew install imagemagick
brew install graphicsmagick
It was working for a while but for no reason it starts to showing the above error again.
I checked that i have installed imagemagick and graphicksmagick in system and its working from terminal.
I checked if i have it in $PATH and its there.
If i run this in nodejs it shows correct version of imagemagick in console, so i assume path is ok in nodejs.
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) {
if(error)
sys.puts(error);
if(stderr)
sys.puts(stderr);
sys.puts(stdout);
}
exec("identify --version", puts);
This is code which is crashing:
gm(request(url), thumbName)
.resize('300', '300', '^')
.gravity('Center')
.crop('300', '300')
.toBuffer('JPG',function (err, buffer) {
var data = {
Bucket: bucket,
Key: thumbName,
Body: buffer,
ACL:'public-read',
ContentType: 'image/jpeg'
};
s3.putObject(data, function(err, res) {
....
});
Everything is working when i deploy it on heroku
IF someone will have this issue i solved it.
I add variable PATH to enviroment variables in node with this value
bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin

Resources