File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import process from 'node:process'
2+ import { chmodSync } from 'node:fs'
23import type { UnpluginFactory } from 'unplugin'
34import { createUnplugin } from 'unplugin'
45import type { ResolvedConfig , ViteDevServer } from 'vite'
@@ -37,12 +38,12 @@ function registerExit(clear: (() => Promise<any>) | (() => any)) {
3738
3839 process . once ( 'SIGINT' , async ( ) => {
3940 await clear ( )
40- process . emit ( 'SIGINT' )
41+ process . exit ( 0 )
4142 } )
4243
4344 process . once ( 'SIGTERM' , async ( ) => {
4445 await clear ( )
45- process . emit ( 'SIGTERM' )
46+ process . exit ( 0 )
4647 } )
4748}
4849
@@ -87,6 +88,12 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
8788 const _printUrls = server . printUrls
8889 server . printUrls = ( ) => {
8990 _printUrls ( )
91+
92+ // fix `Error: EPERM: operation not permitted`
93+ const pwd = process . cwd ( )
94+ const vireCacheDir = `${ pwd } /node_modules/.vite`
95+ chmodSync ( vireCacheDir , 0o777 )
96+
9097 let source = `localhost:${ config . server . port } `
9198 const url = server . resolvedUrls ?. local [ 0 ]
9299 if ( url ) {
You can’t perform that action at this time.
0 commit comments