严格模式外尚不支持块范围的声明

编程入门 行业动态 更新时间:2024-10-24 12:32:36
本文介绍了严格模式外尚不支持块范围的声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在Homestead流浪者盒子上运行 Laravel 5.4 .我已经用npm install命令安装了所有npm依赖项.不会产生任何错误.

I'm running Laravel 5.4 on my Homestead vagrant box. I've installed all the npm dependencies with npm install command. That didn't produce any errors.

在我的 webpack.min.js 文件中,我有:

const { mix } = require('laravel-mix'); /* |-------------------------------------------------------------------------- | Mix Asset Management |-------------------------------------------------------------------------- | | Mix provides a clean, fluent API for defining some Webpack build steps | for your Laravel application. By default, we are compiling the Sass | file for the application as well as bundling up all the JS files. | */ mix.js([ 'resources/assets/plugins/jquery-1.11.3.min.js', 'resources/assets/plugins/bootstrap/js/bootstrap.min.js', 'resources/assets/js/main.js' ], 'public/js' ); mixbine([ 'resources/assets/plugins/bootstrap/css/bootstrap.min.css', 'resources/assets/plugins/font-awesome/css/font-awesome.css', 'resources/assets/css/styles.css' ], 'public/css/all.css');

当我想运行npm run production时,出现以下错误:

When I want to run npm run production I'm getting the following errors:

> @ production /home/vagrant/projects/nielsvroman > node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js /home/vagrant/projects/nielsvroman/node_modules/laravel-mix/setup/webpack.config.js:120 let extractPlugin = new plugins.ExtractTextPlugin( ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:404:25) at Object.Module._extensions..js (module.js:432:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Module.require (module.js:366:17) at require (module.js:385:17) at requireConfig (/home/vagrant/projects/nielsvroman/node_modules/webpack/bin/convert-argv.js:96:18) at /home/vagrant/projects/nielsvroman/node_modules/webpack/bin/convert-argv.js:109:17 at Array.forEach (native) npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "production" npm ERR! node v5.0.0 npm ERR! npm v3.3.6 npm ERR! code ELIFECYCLE npm ERR! @ production: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ production script 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'. npm ERR! This is most likely a problem with the package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! You can get their info via: npm ERR! npm owner ls npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /home/vagrant/projects/nielsvroman/npm-debug.log

这可能是什么问题?

推荐答案

我在Ubuntu上的旧版本的nodejs包也遇到了同样的问题.我刚刚更新到7.5,并且可以正常工作.

I had the same problem coused by the old version of nodejs package on Ubuntu. I've just updated to 7.5 and it's working.

curl -sL deb.nodesource/setup_7.x | sudo -E bash - sudo apt-get install -y nodejs

更多推荐

严格模式外尚不支持块范围的声明

本文发布于:2023-11-15 04:40:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1591229.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:尚不   声明   模式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!