我制作了一个带有create-remix的应用程序,并选择使用Cloud Flare Pages。制作了应用程序,但当我运行npm run dev
时,我遇到了一个错误。我使用的是最新的节点版本(v17.3.1(。我第一次运行开发脚本时收到这个错误:
Watching Remix app in development mode...
Compiling worker to "/tmp/functionsWorker.js"...
✘ [ERROR] Could not resolve "../build"
functions/[[path]].js:4:23:
4 │ import * as build from "../build";
╵ ~~~~~~~~~~
1 error(s) and 0 warning(s) when compiling Worker.
Build failed with 1 error:
functions/[[path]].js:4:23: ERROR: Could not resolve "../build"
ERROR: "dev:wrangler" exited with 1.
然后,如果我再次运行它,我会收到这个错误(可能是因为它在我收到错误之前第一次运行时构建了构建文件夹(:
Watching Remix app in development mode...
Compiling worker to "/tmp/functionsWorker.js"...
✘ [ERROR] Could not resolve "../build"
functions/[[path]].js:4:23:
4 │ import * as build from "../build";
╵ ~~~~~~~~~~
1 error(s) and 0 warning(s) when compiling Worker.
Build failed with 1 error:
functions/[[path]].js:4:23: ERROR: Could not resolve "../build"
ERROR: "dev:wrangler" exited with 1.
我知道为什么我得到这个错误,因为它是默认模板。提前谢谢。
我在混音discord服务器上发现,您需要降级版本来解决此问题。要做到这一点,只需运行npm install wrangler@beta