按照官网的流程来

1.新建工程
2.下载依赖
3.然后把改工程拖到vscode中,在vscode中新建终端启动,然后就报错,报错如下:

JeremyMacBook-Pro@liu:~/Documents/Learn/myVite#yarn dev
yarn run v1.22.10
warning package.json: No license field
$ vite
 > error: Cannot read directory "../..": operation not permitted

failed to load config from /Users/liu/Documents/Learn/myVite/vite.config.js
error when starting dev server:
Error: Build failed with 1 error:
error: Cannot read directory "../..": operation not permitted
    at failureErrorWithLog (/Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:1451:15)
    at /Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:1131:28
    at runOnEndCallbacks (/Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:921:63)
    at buildResponseToResult (/Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:1129:7)
    at /Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:1238:14
    at /Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:609:9
    at handleIncomingPacket (/Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:706:9)
    at Socket.readFromStdout (/Users/liu/Documents/Learn/myVite/node_modules/esbuild/lib/main.js:576:7)
    at Socket.emit (node:events:365:28)
    at Socket.emit (node:domain:470:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
JeremyMacBook-Pro@1liu:~/Documents/Learn/myVite#

但是
尝试一:直接在终端中启动,不在vscode的终端中启动就可以运行起来。
尝试二:将工程拷贝到桌面上,然后在vscode的终端中启动就可以运行起来。

分析:
vscode中新建的终端存在管理员权限的问题,但是使用 sudo yarn dev启动也会报错。(不明白,求大佬答疑)。从不需要权限的路径中(桌面路径下+vscode终端)再启动可以启动成功。
如果遇到类似问题可以更换工程路径尝试。

放一张启动成功的图纪念吧
请添加图片描述

Logo

前往低代码交流专区

更多推荐