clean-css TypeError cannot read property '0' of null - gulp-uglify

I am trying to minify my code and i always get this error when it runs clean-css.
/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/extractor.js:66
return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase();
^
TypeError: Cannot read property '0' of null
at findNameRoot (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/extractor.js:66:59)
at extract (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/extractor.js:36:9)
at restructure (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/restructure.js:297:22)
at optimize (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/advanced.js:71:5)
at minify (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/clean.js:228:5)
at whenSourceMapReady (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/clean.js:135:7)
at Object.whenDone (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/clean.js:155:14)
at processNext (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/imports/inliner.js:105:13)
at importFrom (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/imports/inliner.js:79:10)
at ImportInliner.process (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/imports/inliner.js:38:10)
Error: Hook failed with error code 8: /home/k1ngsley/Projects/mobile_rea/partners-mobile-app/hooks/after_prepare/070_uglify.js
at /home/k1ngsley/npm/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:195:23
at _rejected (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:448:13)
I have read different posts that says remove commented lines etc but all hasnt worked out for me.
Any one has any other ideas or ways to solve this issue

Take a look at min.css utility that is more fastest and fault-tolerance.

Related

My react app gives an error for some reason

Error:
src\images\navbar.js
Line 2:11: Parsing error: Unexpected token, expected "from" (2:11)
src\navbar.js
Line 2:11: Parsing error: Unexpected token, expected "from" (2:11)
the project on GitHub: https://github.com/PufflyMan/airbnb-exp-clone
It's pretty straightforward code but no matter what I tried, I couldn't fix it. Thanks for attention!
It just fixed itself. I didn't do anything

"TypeError: Cannot read property 'pseudoType' of undefined" with chrome-devtools

I'm developing an electron app with React for the front-end. I get the following error in my console when I run my app and hit refresh. My app works as expected, but it's kind of annoying to see this error pop up in my console and not know what it means. Any ideas?
This is the error message I get in my console:
[1] [36084:0511/083524.886880:ERROR:CONSOLE(972)] "TypeError: Cannot read property 'pseudoType' of undefined TypeError: Cannot read property 'pseudoType' of undefined
[1] at SDK.DOMNode._removeChild (chrome-devtools://devtools/bundled/shell.js:4301:28)
[1] at SDK.DOMModel._childNodeRemoved (chrome-devtools://devtools/bundled/shell.js:4420:121)
[1] at SDK.DOMDispatcher.childNodeRemoved (chrome-devtools://devtools/bundled/shell.js:4464:54)
[1] at Protocol.InspectorBackend._DispatcherPrototype.dispatch (chrome-devtools://devtools/bundled/shell.js:3399:26)
[1] at Protocol.SessionRouter._onMessage (chrome-devtools://devtools/bundled/shell.js:3355:41)
[1] at SDK.MainConnection._dispatchMessage (chrome-devtools://devtools/bundled/shell.js:3486:17)
[1] at Common.Object.dispatchEventToListeners (chrome-devtools://devtools/bundled/shell.js:494:23)
[1] at innerDispatch (chrome-devtools://devtools/bundled/shell.js:972:98)
[1] at Host.InspectorFrontendAPIImpl._dispatch (chrome-devtools://devtools/bundled/shell.js:972:1)
[1] at DevToolsAPIImpl._dispatchOnInspectorFrontendAPI (chrome-devtools://devtools/bundled/devtools_compatibility.js:57:36)", source: chrome-devtools://devtools/bundled/shell.js (972)
I've isolated the error to this snippet of code below. If I comment it out, I don't get the error. I couldn't find the cause of the error by reading the BrowserWindow docs.
BrowserWindow.addDevToolsExtension(
path.join(
os.homedir(),
"/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/3.6.0_0"
)
);
BrowserWindow.addDevToolsExtension(
path.join(
os.homedir(),
"/Library/Application Support/Google/Chrome/Default/Extensions/lmhkpmbekcpmknklioeibfkpmmfibljd/2.17.0_0"
)
);
mainWindow.webContents.openDevTools();
I think that the problems here could be of two different types: the path is incorrect, there is already a path that exists as the one you passed as a parameter or you are calling this function before that the module app is on its ready state.
To solve the first problem i would test the path that os.homedir() gives you back in a different part of the code to see what ends up to be at the time that you join it with the path indicated
in the function join; "/Library/Application/Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/3.6.0_0".
To solve the second problem i would refactor the code to call the function in the appropriate lifecycle point to be sure that the app module is on the ready state.

Require not defined error: Karma and Jasmine

I am testing nodejs API and I included file in karma.config.js
I got the following error: Require not defined.
Then as per the suggestions given in other posts I added browserify to that file, but now I am getting different error.
` files: [
'poc/app/api.js', // file where there is require statements
'tests/sample.test.js' // my test file
],
preprocessors: {
'poc/app/api.js':['browserify']
},`
Uncaught TypeError: Cannot read property 'prototype' of undefined
Please let me know how to resolve this.
Uncaught TypeError: Cannot read property 'prototype' of undefined
This error should also include a file name and line number. Since you didn't include that information or the source code, the only advice that can be given here is to check that line of that file, see what can be undefined, track how it got there, where it should be defined but is not and fix the problems that responsible for that.

Protractor: Invalid locator error with isElementPresent

I have the following simple line of code in my e2e test...
var promise = ptor.isElementPresent(element(by.binding('firstName')));
I get an error that says TypeError: Invalid locator. I don't see many other people getting this error after googling it. Where did I make an error?
I believe the syntax is(remove element(...)...
var promise = ptor.isElementPresent(by.binding('firstName'));

mpdf no output and php errors in mpdf.php

I'm trying to generate a pdp file in a cakephp application. Therefore, I use the mpdf library as a vendor. But when I try to make a even very simple output it doesn't work. Then when I use the debug property, it shows php errors in the mpdf.php file.
Here is my source code:
<?php
$mpdf=new mPDF();
$mpdf->WriteHTML('hello');
$mpdf->debug = true;
$mpdf->Output();
exit;
?>
And these are the errors shown in the browser:
Notice (8): Undefined index: BODY [APP\vendors\MPDF54\mpdf.php, line 14242]
Notice (8): Undefined index: BODY>>ID>> [APP\vendors\MPDF54\mpdf.php, line 14288]
Notice (8): Undefined offset: -1 [APP\vendors\MPDF54\mpdf.php, line 14421]
Thank you for your help!
This is not a CakePHP problem but related to the library you're using.
Read about how to use the WriteHTML() method.
http://mpdf1.com/manual/index.php?tid=121
And try passing 2 as the 2nd argument.
$mpdf->WriteHTML('hello', 2);
If this still does not work read the documentation, check the examples there.
This is caused by buggy mpdf code. It depends on error (level "notice") reporting to be switched off (it switches it off itself). But if you handle errors some nonstandard way, it is problem..
I solved it by ignoring errors from mpdf.php file in my custom error handler.
I was using my custom error reporting via set_error_handler();

Resources