npm run prod 错误:SyntaxError: Unexpected token = at new Script (vm.js:83:7)

问题描述

我需要在 Laravel 应用程序上运行 npm run prod 但出现错误

SyntaxError: Unexpected token = at new Script (vm.js:83:7)

操作系统是 Ubuntu 20,04 节点版本是 15.12.0 npm 版本 7.7.5。

known issue on Ubuntu 20,04 because of node version 10 但我升级了还是一样。也试过 node -v 15.2

> npm run production    

> production
> mix --production

[webpack-cli] /var/www/deploy-tmp/tatrytec.eu/node_modules/laravel-mix/src/Mix.js:18
    static _primary = null;
                    ^

SyntaxError: Unexpected token =
    at new Script (vm.js:83:7)
    at NativeCompileCache._moduleCompile (/var/www/deploy-tmp/tatrytec.eu/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/var/www/deploy-tmp/tatrytec.eu/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/var/www/deploy-tmp/tatrytec.eu/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at module.exports (/var/www/deploy-tmp/tatrytec.eu/node_modules/laravel-mix/setup/webpack.config.js:2:17)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)