• Register
0 votes
520 views

Problem :

I am running Laravel 5.4 on my Homestead vagrant box but when I want to run npm run production I am getting the following error

block-scoped declarations (let, const, function, class) not yet supported outside strict mode.

6.9k points

1 Answer

0 votes

Solution :

I had faced the same problem in the recent past with one of my test script in NodeJS and i was able to resolved my error with the use of ECMAScript 5's strict mode.
"use strict";

I had added above line at the top of my script and it works really well.

Strict mode makes various changes to normal JavaScript semantics as follows:

  1. It eliminates some JavaScript silent errors by just changing them to throw errors.

  2. Fixes mistakes that will make it difficult for JavaScript engines to perform optimizations: strict mode code can be made to run faster than identical code that is not strict mode.

  3. It also prohibits some syntax likely to be defined in future versions of ECMAScript.

38.6k points

Related questions

1 vote
1 answer 331 views
331 views
Problem : I am naïve to Webpack. As the Webpack does not support the native webworker syntax so currently I want to use a worker-loader npm module but because of some unknown reason t I am facing the below weird error. Cannot assign to read only property 'exports ... but still unable to understand the root cause of above error. Now I am in badly need of the expert advice to fix above error.
asked Apr 9 morrisBson 3.2k points
0 votes
0 answers 46 views
46 views
TypeError: Router.use() requires a middleware function but got a Object at Function.use (E:\firebase-CRUD_api\functions\node_modules\express\lib\router\index.js:458:13) at Function.<anonymous> (E:\firebase-CRUD_api\functions\node_modules\express\lib\application.js:220:21) ... at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1042:19)
asked May 17 anonymous
0 votes
1 answer 2K views
2K views
Problem : I am just starting coding using the nodejs with express. So I simply did this in my file test.js which is into my folder routes : const myexpress = require('express'); const myrouter = new myexpress.Router(); myrouter.get('/test', (req, res) => { res.send(` ... browser, it tells me it Cannot get/test I don't understand why this is happening to me. Please let me know how can I fix this?
asked Jan 23 jwilliam 3.9k points
0 votes
1 answer 156 views
156 views
Problem : I have recently updated the node to 7.2.1 and noticed that there is the warning coming as below : (node:4346) DeprecationWarning: Calling an asynchronous function without callback is deprecated. Why is this 4346 ? I only have 2000 lines of code in the js file, so it must not be the line-number. Where should I look for that code?
asked Dec 10, 2019 alecxe 7.5k points