How do I fix the error? If I paste the code in the dev console it works but if I run it the image won't change unless I do stop(); which then breaks the search bar and background
CODE
document.getElementById('hplogo').src="https://upload.wikimedia.org/wikipedia/en/thumb/6/63/IMG_%28business%29.svg/1280px-IMG_%28business%29.svg.png";
<div class="" id="lga" style="height: 250px;"><img alt="Google" height="92" id="hplogo" src="/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png" width="272" title="Google" style="padding-top: 115px;"><div id="logo-sub"></div></div>
ERROR
VM13104:2 TypeError: Cannot set property 'src' of null
at Window.eval (eval at <anonymous> (:2:479), <anonymous>:15:38)
at <anonymous>:2:479
at eval (eval at <anonymous> (:2:479), <anonymous>:2:1)
at eval (eval at <anonymous> (:2:479), <anonymous>:3:3)
at Object.eval (eval at <anonymous> (:2:479), <anonymous>:16:6)
at eval (eval at <anonymous> (:2:479), <anonymous>:16:50)
at eval (<anonymous>)
at <anonymous>:2:479
at Object.c [as F_c] (<anonymous>:2:324)
at Object.E_u (<anonymous>:3:143)
Related
I'm trying to verify a 2FA code using speakeasy library :
try {
var verified = speakeasy.totp.verify({
secret: keyBase32_,
encoding: 'base32',
token: code as string,
});
}
catch (e) {
console.log(e);
}
However I keep getting this error:
error: ReferenceError: Buffer is not defined
at Object.digest (eval at <anonymous> (eval at <anonymous> (lockdown.umd.min.js:1:22409)), <anonymous>:52045:13)
at Object.hotpGenerate (eval at <anonymous> (eval at <anonymous> (lockdown.umd.min.js:1:22409)), <anonymous>:52061:52)
at Function.hotpVerifyDelta [as verifyDelta] (eval at <anonymous> (eval at <anonymous> (lockdown.umd.min.js:1:22409)), <anonymous>:52084:36)
at Function.totpVerifyDelta [as verifyDelta] (eval at <anonymous> (eval at <anonymous> (lockdown.umd.min.js:1:22409)), <anonymous>:52113:38)
at Function.totpVerify [as verify] (eval at <anonymous> (eval at <anonymous> (lockdown.umd.min.js:1:22409)), <anonymous>:52120:33)
at onRpcRequest (eval at <anonymous> (eval at <anonymous> (lockdown.umd.min.js:1:22409)), <anonymous>:54322:41)
at async f.executeInSnapContext (bundle.js:2:772169)
at async bundle.js:2:767893
at async Object.snapRpc (bundle.js:2:773159)
at async f.onCommandRequest (bundle.js:2:769013)
I am running this inside a Chrome extension. When I ran the code locally it worked fine but fails in the browser. I read that it's because the Buffer global object is not available in browsers so how can I bypass this?
Any help will be appreciated.
I work at React-Redux project.
I use ag-grid and have problems.
I get at console:
Uncaught TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf (<anonymous>)
at __extends (eval at <anonymous> (bundle.js:13399), <anonymous>:8:9)
at eval (eval at <anonymous> (bundle.js:13399), <anonymous>:28:5)
at eval (eval at <anonymous> (bundle.js:13399), <anonymous>:301:2)
at Object.<anonymous> (bundle.js:13399)
at __webpack_require__ (bundle.js:556)
at fn (bundle.js:87)
at eval (eval at <anonymous> (bundle.js:13390), <anonymous>:14:19)
at Object.<anonymous> (bundle.js:13390)
at __webpack_require__ (bundle.js:556)
at fn (bundle.js:87)
at eval (eval at <anonymous> (bundle.js:13255), <anonymous>:10:24)
at Object.<anonymous> (bundle.js:13255)
at __webpack_require__ (bundle.js:556)
at fn (bundle.js:87)
at eval (eval at <anonymous> (bundle.js:13246), <anonymous>:1:1)
Any solution?
Here is my packages.json relevant rows:
"ag-grid": "~7.1.0",
"ag-grid-enterprise": "^14.2.0",
"ag-grid-react": "~7.1.0",
Got the same issue.
But tried installing the same version of ag-grid-enterprise as that of ag-grid-react, then it worked.
"ag-grid-community": "^25.3.0",
"ag-grid-enterprise": "^25.3.0",
"ag-grid-react": "^25.3.0",
Hope it helps you! :)
I am geting to build my project with gulp and uglify-js but it fails and can’t build. And I can’t find what is wrong with this small code snippet.
Function:
function getOneSignalToken() {
window.bridge.post('onesignaltoken', {}, (results, error) => {
$('#onesignal_token').html(results.token);
});
}
Error
events.js:160
throw er; // Unhandled 'error' event
^
Error
at new JS_Parse_Error (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :1545:18)
at js_error (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :1553:11)
at croak (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2092:9)
at token_error (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2100:9)
at unexpected (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2106:9)
at expr_atom (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2633:9)
at maybe_unary (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2795:19)
at expr_ops (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2830:24)
at maybe_conditional (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1),:2835:20)
at maybe_assign (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2859:20)
at maybe_assign (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2867:32)
at expression (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2878:20)
at expr_list (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2644:24)
at subscripts (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2778:30)
at subscripts (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2755:20)
at subscripts (eval at (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:28:1), :2755:20)
Eriks-MacBook-Pro:nat5 erik$
Converting to pre es6/es2015 syntax
(results, error) => {...}
will become
function(results, error) {...}
To use gulp with new style es2015 see: https://markgoodyear.com/2015/06/using-es6-with-gulp/
And if you want to upgrade uglify-js to support es6 use the uglify-es npm package: https://www.npmjs.com/package/uglify-es
As #peter sad.. this fixed the problem:
function getOneSignalToken() {
window.bridge.post('onesignaltoken', {}, function(results, error){
$('#onesignal_token').html(results.token);
});
}
I am geting to build my project with gulp and uglify-js but it fails and can’t build. And I can’t find what is wrong with this small code snippet.
Function:
function getGPSLocation() {
var unregisterHandler = window.bridge.on('gps_location', (parameters)=> {
$('#gps_token').html("Longitude: " + parameters.longitude + " <br /> Latitude: " + parameters.latitude)
})
}
Error:
events.js:160
throw er; // Unhandled 'error' event
Error log:
events.js:160
throw er; // Unhandled 'error' event
^
Error
at new JS_Parse_Error (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:1545:18)
at js_error (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:1553:11)
at croak (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2092:9)
at token_error (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2100:9)
at unexpected (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2106:9)
at expr_atom (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2633:9)
at maybe_unary (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2795:19)
at expr_ops (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2830:24)
at maybe_conditional (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2835:20)
at maybe_assign (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2859:20)
at maybe_assign (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2867:32)
at expression (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2878:20)
at expr_list (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2644:24)
at subscripts (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2778:30)
at subscripts (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2755:20)
at subscripts (eval at <anonymous> (/Users/erik/Desktop/Erik/code/nat5/node_modules/uglify-js/tools/node.js:1:0), <anonymous>:2755:20)
Eriks-MacBook-Pro:nat5 erik$
I am using gulp-uglify and gulp-concat to minify and concatenate my js files as follows:
gulp.task('scripts', function() {
gulp.src([
'./development/assets/js/lib/jquery-1.11.2.min.js',
'./development/assets/js/lib/foundation.min.js',
'./development/assets/js/lib/angular.min.js',
'./development/assets/js/lib/angular.min.js.map',
'./development/assets/js/lib/angular-ui-router.min.js',
'./development/assets/js/lib/angular-animate.js',
'./development/assets/js/lib/angular-sanitize.min.js',
'./development/assets/js/lib/loading-bar.min.js',
'./development/assets/js/lib/angular-sanitize.min.js',
'./development/assets/js/lib/toastr.min.js',
'./development/assets/js/lib/angular-datepicker.js',
'./development/assets/js/lib/angucomplete-alt.js',
'./development/assets/js/lib/d3.v3.min.js',
'./development/assets/js/lib/mm-foundation.min.js',
'./development/assets/js/lib/ng-text-truncate.js',
'./development/assets/js/lib/angular-lazy-loader.min.js',
'./development/assets/js/lib/jquery-jvectormap-2.0.3.min.js',
'./development/assets/js/lib/jquery-jvectormap-world-mill.js',
'./development/assets/js/lib/jquery.tagcanvas.min.js',
'./development/assets/js/lib/angular-touch.min.js',
'./development/assets/js/lib/slick.min.js',
'./development/assets/js/lib/angular-slick.min.js',
'./development/assets/js/lib/d3.tip.js',
'./development/assets/js/lib/angular-pageslide-directive.js',
'./development/assets/js/app.js',
'./development/assets/js/lib/upload.js',
'./development/assets/js/controllers/**/*.js',
'./development/assets/js/services/**/*.js',
'./development/assets/js/filters/**/*.js',
'./development/assets/js/directives/**/*.js'
])
.pipe(concat('production.js'))
.pipe(uglify())
.pipe(gulp.dest('./production/assets'))
})
However, when I run gulp scripts I get an error. This is the error stack trace:
events.js:85
throw er; // Unhandled 'error' event
^
Error
at new JS_Parse_Error (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1526:18)
at js_error (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1534:11)
at croak (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2025:9)
at token_error (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2033:9)
at unexpected (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2039:9)
at semicolon (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2059:43)
at simple_statement (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2239:73)
at eval (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2092:47)
at eval (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2072:24)
at block_ (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2352:20)
Any idea whats going wrong? Gulp version is 3.9.0 and the node version is 0.12.7.
Found the issue. It was caused by './development/assets/js/lib/angular.min.js.map'. uglify cannot handle map files.