0

我使用 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.

我知道为什么我会收到此错误,因为它是默认模板。提前致谢。

4

1 回答 1

0

我在 remix discord 服务器上发现您需要降级版本才能解决此问题。为此,只需运行npm install wrangler@beta

于 2022-01-11T22:51:33.277 回答