首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Laravel-mix中的错误

Laravel-mix中的错误
EN

Stack Overflow用户
提问于 2018-04-05 19:30:16
回答 4查看 3.5K关注 0票数 0

我将Laravel-mix与npm和node一起安装在VPS上

操作系统是Ubuntu 16.4

Laravel版本为: 5.6

npm版本为: 3.5.2

节点版本为: v4.2.6

运行sudo npm run production之后

显示此错误:

代码语言:javascript
复制
production /var/www/html
cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --
no-progress --hide-modules --config=node_modules/laravel-
mix/setup/webpack.config.js
/var/www/html/node_modules/laravel-mix/setup/webpack.config.js:6
let mix = require('../src/index');
^^^
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:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at requireConfig (/var/www/html/node_modules/webpack/bin/convert-argv.js:97:18)
at /var/www/html/node_modules/webpack/bin/convert-argv.js:104:17
at Array.forEach (native)

npm ERR! Linux 4.4.0-87-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "production"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! @ production: `cross-env NODE_ENV=production 
node_modules/webpack/bin/webpack.js --no-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 'cross-env 
NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm 
installed.
npm ERR! If you do, 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!     cross-env NODE_ENV=production         node_modules/webpack/bin/webpack.js --no-progress --hide-modules --    config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this     project with:
npm ERR!     npm bugs 
npm ERR! Or if that isn't available, 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!     /var/www/html/npm-debug.log

如何解决这个问题?

EN

回答 4

Stack Overflow用户

发布于 2020-10-10 19:32:30

我只是遵循了这些步骤,一切都正常工作。尝试执行完全重置:

代码语言:javascript
复制
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
票数 1
EN

Stack Overflow用户

发布于 2018-04-05 21:32:50

首先将您的npmnode版本更新为最新版本。

只需运行npm i -g npm

而且运行npm脚本不需要sudo。只需使用npm run production即可

票数 0
EN

Stack Overflow用户

发布于 2021-01-17 00:29:58

您可能正在使用新/旧版本的node,该版本与您的一些包不兼容(请参阅了解运行npm install时的所有警告)。尝试更改节点版本。

代码语言:javascript
复制
nvm use 14
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49671277

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档