简体   繁体   English

启动开发服务器 npm 运行开发时出错

[英]error when starting dev server npm run dev

so i was tinkering with laravel and i tried to install bootstrap.所以我在修补 laravel 并尝试安装引导程序。 as soon as i need to type npm install && npm run dev, the install part goes with no hiccups.一旦我需要输入 npm install && npm 运行开发,安装部分就不会出现任何问题。 only when the run dev command this error shows up.仅当 run dev 命令出现此错误时。

C:\Users\Enduser\Documents\laravel projects\sampleblog>npm run dev npm WARN config global --global , --local are deprecated. C:\Users\Enduser\Documents\laravel projects\sampleblog>npm run dev npm WARN config global --global , --local已弃用。 Use --location=global instead.请改用--location=global

dev vite开发者

error when starting dev server:启动开发服务器时出错:

Error: listen EACCES: permission denied 127.0.0.1:3000错误:听 EACCES:权限被拒绝 127.0.0.1:3000

 at Server.setupListenHandle [as _listen2] (node:net:1355:21) at listenInCluster (node:net:1420:12) at doListen (node:net:1559:7) at processTicksAndRejections (node:internal/process/task_queues:84:21)

any ideas on why this is happening?关于为什么会发生这种情况的任何想法? thanks for the help.谢谢您的帮助。

Go to folder C:\Program Files\nodejs Go 到文件夹 C:\Program Files\nodejs

Open the file npm, npm.cmd, npx, npx.cmd in a text editor在文本编辑器中打开文件npm、npm.cmd、npx、npx.ZDFFF0A7FA1A55C8C152966C19FZ

Replace prefix -g with prefix --location=global前缀 -g替换为前缀 --location=global

and try again with the same command.并使用相同的命令重试。

 npm run dev

Hope this will resolve your issue.希望这能解决您的问题。

In case you're using Laravel 9, Vite is the default tool for bundling assets.如果您使用的是 Laravel 9,则 Vite 是捆绑资产的默认工具。 You may want to roll back to webpack.mix by changing您可能希望通过更改回滚到 webpack.mix

"development": "vite" “发展”:“vite”

to

"development": "mix" “发展”:“混合”

in package.json , script section.package.json脚本部分。

or in case of diving into this new feature, you can check Laravel documentation, here .或者在深入研究这个新功能的情况下,您可以在此处查看 Laravel 文档。

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

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