• Register
0 votes
689 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 5 3
6,930 points

Please log in or register to answer this question.

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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 4 views
4 views
Problem: block-scoped declarations (let, const, function, class) not yet supported outside strict mode
asked 4 days ago Muneeb Saadii 2.4k points
1 vote
1 answer 493 views
493 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, 2020 morrisBson 3.2k points
0 votes
1 answer 126 views
0 votes
0 answers 54 views
54 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, 2020 anonymous
0 votes
1 answer 2.9K views
2.9K 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, 2020 jwilliam 3.9k points
0 votes
1 answer 196 views
196 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
0 votes
2 answers 3.8K views
3.8K views
Problem : Facing following express issue throw new typeerror('router.use() requires a middleware function but got a ' + gettype(fn))
asked Nov 18, 2019 peterlaw 6.9k points
0 votes
1 answer 3 views
3 views
Problem: node is not recognized as an internal or external command.
asked 5 days ago Ethan ross 1.8k points
0 votes
1 answer 10 views
10 views
Problem: error: the `brew link` step did not complete successfully.
asked 5 days ago Dan phillip 1.9k points
0 votes
0 answers 2 views
2 views
Problem: user "root" does not have permission to access the dev dir
asked Feb 19 Dan phillip 1.9k points