ble*_*est 37 linux npm server npm-run sveltekit
我想使用该npm run dev --host命令在 LAN 上公开我的 svelte 应用程序,但它显示:
> frontend@0.0.1 dev
> svelte-kit dev
SvelteKit v1.0.0-next.295
local: http://localhost:3000
network: not exposed
Use --host to expose server to other devices on this network
Run Code Online (Sandbox Code Playgroud)
小智 96
您必须--在实际标志之前添加:
npm run dev -- --host
Run Code Online (Sandbox Code Playgroud)
它应该输出:
> project@0.0.1 dev
> svelte-kit dev "--host"
SvelteKit v1.0.0-next.316
local: http://localhost:3000
network: http://***.***.**.**:3000
Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules
Run Code Online (Sandbox Code Playgroud)
小智 9
如果您在package.json文件中使用vite,请在dev行执行此操作:
"scripts": {
"dev": "vite --host --port 8888",
..... what ever else was here.....
},
Run Code Online (Sandbox Code Playgroud)
如果您使用Sirv,请在package.json中尝试以下操作:
"start": "sirv public --no-clear --host 0.0.0.0",
Run Code Online (Sandbox Code Playgroud)
如果您想要不同的端口,请尝试以下操作:
"start": "sirv public --no-clear --host 0.0.0.0 --port 8888",
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
57116 次 |
| 最近记录: |