相关疑难解决方法(0)

Next.js 无法识别“@types/react”

当我尝试运行 Next.js 应用程序时,npm run dev收到一条错误消息,指出我没有使用 Typescript 运行 Next 所需的包:

Please install @types/react by running:

        npm install --save-dev @types/react

If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
Run Code Online (Sandbox Code Playgroud)

但是,已安装模块“@types/react”。我尝试运行npm install --save-dev @types/react并没有收到任何错误消息(只是一堆警告,但我不认为它们是问题所在)。

我该如何解决这个问题并运行该项目?

javascript npm typescript reactjs next.js

61
推荐指数
2
解决办法
3万
查看次数

构建 Docker 镜像时已安装 Typescript 时要求安装

我正在尝试构建一个使用 Typescript 的 Next.js/React 应用程序的 docker 镜像。

安装了 Typescript,我可以在没有 docker 的情况下在本地运行构建。

但是,随着 docker 镜像的构建,我得到了以下几点:

Step 8/10 : RUN npm run build
 ---> Running in ee577c719739

> project@0.0.5 build /app
> next build

Creating an optimized production build...
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: …
Run Code Online (Sandbox Code Playgroud)

typescript docker reactjs next.js

15
推荐指数
1
解决办法
9557
查看次数

标签 统计

next.js ×2

reactjs ×2

typescript ×2

docker ×1

javascript ×1

npm ×1