简体   繁体   English

尝试 Laravel jetstream 但在“npm run dev”上出现错误

[英]Trying Laravel jetstream but getting an error on “npm run dev”

lam getting the error below while running npm run dev lam 在运行 npm run dev 时出现以下错误

[webpack-cli] TypeError: this.program.configureOutput is not a function at new WebpackCLI (/home/vagrant/sites/ecom/node_modules/webpack-cli/lib/webpack-cli.js:19:22) at runCLI (/home/vagrant/sites/ecom/node_modules/webpack-cli/lib/bootstrap.js:7:21) at Object. [webpack-cli] TypeError: this.program.configureOutput is not a function at new WebpackCLI (/home/vagrant/sites/ecom/node_modules/webpack-cli/lib/webpack-cli.js:19:22) at runCLI ( /home/vagrant/sites/ecom/node_modules/webpack-cli/lib/bootstrap.js:7:21)在 Object。 (/home/vagrant/sites/ecom/node_modules/webpack-cli/bin/cli.js:23:5) at Module._compile (node:internal/modules/cjs/loader:1092:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10) at Module.load (node:internal/modules/cjs/loader:972:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Module.require (node:internal/modules/cjs/loader:996:19) at require (node:internal/modules/cjs/helpers:92:18) at runCli (/home/vagrant/sites/ecom/node_modules/webpack/bin/webpack.js:54:2) npm ERR! (/home/vagrant/sites/ecom/node_modules/webpack-cli/bin/cli.js:23:5) 在 Module._compile (node:internal/modules/cjs/loader:1092:14) 在 Object.Module。 _extensions..js (node:internal/modules/cjs/loader:1121:10) 在 Module.load (node:internal/modules/cjs/loader:972:32) 在 Function.Module._load (node:internal/modules /cjs/loader:813:14) 在 Module.require (node:internal/modules/cjs/loader:996:19) 在 require (node:internal/modules/cjs/helpers:92:18) 在 runCli (/home /vagrant/sites/ecom/node_modules/webpack/bin/webpack.js:54:2) npm 错误! code 2 npm ERR!代码 2 npm 错误! path /home/vagrant/sites/ecom npm ERR!路径 /home/vagrant/sites/ecom npm 错误! command failed npm ERR!命令失败 npm ERR! command sh -c mix命令 sh -c 混合

npm ERR: A complete log of this run can be found in. npm ERR. npm ERR:此运行的完整日志可在 npm ERR 中找到。 /home/vagrant/.npm/_logs/2021-03-19T11_14_07_947Z-debug.log npm ERR! /home/vagrant/.npm/_logs/2021-03-19T11_14_07_947Z-debug.log npm 错误! code 2 npm ERR!代码 2 npm 错误! path /home/vagrant/sites/ecom npm ERR!路径 /home/vagrant/sites/ecom npm 错误! command failed npm ERR!命令失败 npm ERR! command sh -c npm run development命令 sh -c npm 运行开发

npm ERR: A complete log of this run can be found in. npm ERR. npm ERR:此运行的完整日志可在 npm ERR 中找到。 /home/vagrant/.npm/_logs/2021-03-19T11_14_07_974Z-debug.log /home/vagrant/.npm/_logs/2021-03-19T11_14_07_974Z-debug.log

First try to update your node.js file and then run "npm run dev" and if you again faced the same problem follow the following steps:首先尝试更新您的 node.js 文件,然后运行“npm run dev”,如果您再次遇到同样的问题,请按照以下步骤操作:

Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clean
Step4: npm install
Step5: npm outdated
In this step, it will update your laravel-mix version, it is in the package.json.
Step6: npm install
Step7: npm run dev

After all these steps, everything is good.经过所有这些步骤,一切都很好。 I hope it solve your problem.我希望它能解决你的问题。

I came across this problem when trying to build and run webpack (and webpack-cli locally), after check out from Github (not at all related to Laravel).在从 Github (与 Laravel 完全无关)签出后,我在尝试构建和运行webpack (和本地webpack-cli )时遇到了这个问题。

I found that I forgot to run yarn install for webpack-cli which lead to the issue that an existing version of commander@6 was used, but webpack-cli requires commander@7 .我发现我忘了为webpack-cli运行yarn install ,这导致了使用现有版本的commander@6的问题,但是webpack-cli需要 commands commander@7

npm list commander should tell you that the webpack-cli dependency is unsatisfied. npm list commander应该告诉你webpack-cli依赖不满足。 yarn install should fix it. yarn install应该修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM