【问题标题】:Laravel 8 fresh installation with livewire npm install && npm run dev errorLaravel 8 全新安装,带有 livewire npm install && npm run dev 错误
【发布时间】:2021-01-10 13:02:29
【问题描述】:

在 CLI 中使用 livewire 安装新的 Laravel 8.1 时,我运行 npm run dev 我得到了这个,我是新的,所以请帮帮我?

> mix

[webpack-cli] /var/www/html/Am2/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/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/var/www/html/Am2/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/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at module.exports (/var/www/html/Am2/node_modules/laravel-mix/setup/webpack.config.js:2:17)

错误

【问题讨论】:

    标签: laravel


    【解决方案1】:

    需要更新节点版本。

    Ubuntu (Linux)

    运行此命令更新节点

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    

    在此关闭当前终端并打开新终端后,在PROJECT DIR中运行此命令

    sudo npm install 
    npm run dev
    

    【讨论】:

    • 谢谢@Parth 这个解决方案就像一个魅力。赞成
    【解决方案2】:

    尝试升级您当前的节点版本

    Current stable15.5.1

    您可以在 Mac-OS 的情况下使用 brew 升级它:

    brew install nvm
    nvm install 15
    nvm use 15
    

    【讨论】:

    • 我有节点 15.12 但还是同样的错误?你知道可能是什么问题吗?
    猜你喜欢
    • 2021-04-11
    • 2021-04-14
    • 1970-01-01
    • 2018-02-26
    • 1970-01-01
    • 2021-04-08
    • 1970-01-01
    • 2021-10-13
    • 2020-09-25
    相关资源
    最近更新 更多