我正在尝试使用 Livewire 基本身份验证重新安装 Laravel 8。Basic Laravel 安装良好,但在安装 Jetstream 并运行“npm install && npm run dev”时,出现错误。
我发现这个链接表明 laravel mix 有问题:
https://laravel-mix.com/docs/5.0/installation
哪里说:
您不会在项目根目录中找到 webpack.config.js 文件。默认情况下,Laravel 遵循此 repo 中的配置文件。但是,如果您需要配置它,您可以将文件复制到项目根目录,然后相应地更新您的 package.json NPM 脚本:cp node_modules/laravel-mix/setup/webpack.config.js ./。
但我不明白我必须做什么。
用什么更新你的 package.json ?
将 webpack.config.js 文件复制到项目的根文件夹,重新运行 npm install 和 npm run dev 问题仍然存在。
服务器是Centos7。我会很感激这个问题的帮助,因为我完全被这个问题所困扰。我要去泰勒家求个解释!谢谢!
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
/home/myproyect/public_html/proyect/proyectlar/node_modules/cross-env/src/index.js:23
)
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/myproyect/public_html/proyect/proyectlar/node_modules/cross-env/src/bin/cross-env.js:3:18)
npm ERR! Linux 3.10.0-1160.6.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "development"
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --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=development node_modules/webpack/bin/webpack.js --progress --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! /home/myproyect/public_html/proyect/proyectlar/npm-debug.log
npm ERR! Linux 3.10.0-1160.6.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script 'npm run development'.
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! npm run development
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! /home/myproyect/public_html/proyect/proyectlar/npm-debug.log