【问题标题】:How to resolve error when I run command npm run dev运行命令 npm run dev 时如何解决错误
【发布时间】:2021-04-19 02:37:21
【问题描述】:

我正在使用 Laravel 8;我的错误如下。

[webpack-cli] D:\appdownloads\www\laravel_8\chaythu1\node_modules\laravel-mix\src\Mix.js:18
    static _primary = null;
                    ^

SyntaxError: Unexpected token =
    at new Script (vm.js:83:7)
    at NativeCompileCache._moduleCompile (D:\appdownloads\www\laravel_8\chaythu1\node_modules\v8-compile-cache\v8-compile-cache.js:240:18)
    at Module._compile (D:\appdownloads\www\laravel_8\chaythu1\node_modules\v8-compile-cache\v8-compile-cache.js:184:36)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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:690:17)
    at require (D:\appdownloads\www\laravel_8\chaythu1\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at module.exports (D:\appdownloads\www\laravel_8\chaythu1\node_modules\laravel-mix\setup\webpack.config.js:2:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `mix`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Hieu\AppData\Roaming\npm-cache\_logs\2021-01-14T02_56_14_187Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Hieu\AppData\Roaming\npm-cache\_logs\2021-01-14T02_56_14_261Z-debug.log

【问题讨论】:

标签: laravel npm laravel-8


【解决方案1】:

首先,使用node -v 检查您的节点版本。我猜您当前的节点版本不是最新版本。所以升级你的节点然后使用npm installnpm run dev会解决你的问题。

您使用的是 Windows,所以如果您不知道如何升级,请查看How to upgrade node.js on Windows?

【讨论】:

    猜你喜欢
    • 2017-12-28
    • 2020-04-13
    • 2021-02-12
    • 1970-01-01
    • 2018-12-12
    • 2022-08-07
    • 1970-01-01
    • 2020-11-25
    • 1970-01-01
    相关资源
    最近更新 更多