Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
537 views
in Technique[技术] by (71.8m points)

php - npm run dev not working after laravel/ui installation in laravel 8 app

I have installed laravel/ui in my laravel 8 app using

composer require laravel/ui
php artisan ui:auth
php artisan ui bootstrap

Later I did

npm install && npm run dev

npm install command works fine but while running npm run dev,

It generates following error

> @ dev /home/shreyas/Documents/laravel-projects/laracast-course/register-user
> npm run development


> @ development /home/shreyas/Documents/laravel-projects/laracast-course/register-user
> mix

[webpack-cli] /home/shreyas/Documents/laravel-projects/laracast-course/register-user/node_modules/laravel-mix/src/Mix.js:18
    static _primary = null;
                    ^

SyntaxError: Unexpected token =
    at new Script (vm.js:83:7)
    at NativeCompileCache._moduleCompile (/home/shreyas/Documents/laravel-projects/laracast-course/register-user/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/home/shreyas/Documents/laravel-projects/laracast-course/register-user/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 (/home/shreyas/Documents/laravel-projects/laracast-course/register-user/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at module.exports (/home/shreyas/Documents/laravel-projects/laracast-course/register-user/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!     /home/shreyas/.npm/_logs/2021-01-12T09_20_27_344Z-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!     /home/shreyas/.npm/_logs/2021-01-12T09_20_27_447Z-debug.log

Due to this error, app did not compiled anything to render from public folder of laravel. I am using

6.14.4 (npm -v)

v10.19.0 (node -v)

I tried to reinstall npm and node. But after reinstalling, error is still there

webpack.mix.js file

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/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .sourceMaps();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...