Apple 芯片上 运行 Nuxt 3 [3.0.0-rc.3] 的问题
Problems with running Nuxt 3 [3.0.0-rc.3] on Apple silicon
我按照 quick guide 使用操作系统 macOS Monterey 12.4
MacBook Pro M1 Max / Node v16.15.0 创建了一个应用程序,也尝试过使用 18.
当访问主机http://localhost:3000
时,它不断重复错误[下面显示终端中的错误]。看来可能是热重载的问题。
我尝试使用 brew 和 nvm 为不同的节点版本重新安装节点。此问题仅在 Apple Silicon 上出现曲线,在基于 Intel 的机器 上不出现。我该如何解决这个问题?
正在创建 nuxt 应用程序:
npx nuxi init nuxt-app
package.json :
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"nuxt": "3.0.0-rc.3"
}
}
之后运行npm run dev
就报错了:
Nuxt CLI v3.0.0-rc.3 11:19:41
11:19:41
> Local: http://localhost:3000/
> Network: http://172.30.1.18:3000/
✘ [ERROR] Cannot read directory "../../..": operation not permitted
ERROR 11:19:43 AM [vite] error while updating dependencies: 11:19:43
Error: Build failed with 1 error:
error: Cannot read directory "../../..": operation not permitted
at failureErrorWithLog (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1603:15)
at /Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1249:28
at runOnEndCallbacks (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1034:63)
at buildResponseToResult (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1247:7)
at /Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1356:14
at /Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:666:9
at handleIncomingPacket (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12)
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined (repeated 20 times)
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ℹ Vite server warmed up in 112ms 11:19:43
ℹ Vite client warmed up in 438ms 11:19:43
✔ Vite server built in 335ms 11:19:43
✔ Nitro built in 174 ms nitro 11:19:43
将 NPM 更新为 8.11.0
解决了该问题。
剩下的就是nuxt@3.0.0-rc.3
和node@v16.15.0
.
我已经将 npm 更新到 8.11.0,并且在 M1 Max 上没有问题。
我使用的版本:
- Nuxt: 3.0.0-rc.3
- 节点:v16.15.0
- Npm 8.11.0
我按照 quick guide 使用操作系统 macOS Monterey 12.4
MacBook Pro M1 Max / Node v16.15.0 创建了一个应用程序,也尝试过使用 18.
当访问主机http://localhost:3000
时,它不断重复错误[下面显示终端中的错误]。看来可能是热重载的问题。
我尝试使用 brew 和 nvm 为不同的节点版本重新安装节点。此问题仅在 Apple Silicon 上出现曲线,在基于 Intel 的机器 上不出现。我该如何解决这个问题?
正在创建 nuxt 应用程序:
npx nuxi init nuxt-app
package.json :
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"nuxt": "3.0.0-rc.3"
}
}
之后运行npm run dev
就报错了:
Nuxt CLI v3.0.0-rc.3 11:19:41
11:19:41
> Local: http://localhost:3000/
> Network: http://172.30.1.18:3000/
✘ [ERROR] Cannot read directory "../../..": operation not permitted
ERROR 11:19:43 AM [vite] error while updating dependencies: 11:19:43
Error: Build failed with 1 error:
error: Cannot read directory "../../..": operation not permitted
at failureErrorWithLog (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1603:15)
at /Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1249:28
at runOnEndCallbacks (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1034:63)
at buildResponseToResult (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1247:7)
at /Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:1356:14
at /Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:666:9
at handleIncomingPacket (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (/Users/USERNAME/nuxt-appnode_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12)
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined (repeated 20 times)
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/ufo.js?v=2227049b optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ERROR Vite Error, /_nuxt/node_modules/.vite/deps/vue.js?v=3f037d64 optimized info should be defined 11:19:43
ℹ Vite server warmed up in 112ms 11:19:43
ℹ Vite client warmed up in 438ms 11:19:43
✔ Vite server built in 335ms 11:19:43
✔ Nitro built in 174 ms nitro 11:19:43
将 NPM 更新为 8.11.0
解决了该问题。
剩下的就是nuxt@3.0.0-rc.3
和node@v16.15.0
.
我已经将 npm 更新到 8.11.0,并且在 M1 Max 上没有问题。
我使用的版本:
- Nuxt: 3.0.0-rc.3
- 节点:v16.15.0
- Npm 8.11.0