首页 > 解决方案 > 在安装后脚本中运行“下一个构建”后出现“需要适当的加载器”错误

问题描述

这是复制回购: https ://github.com/stomvi/nextjs-postinstall-build

赶紧跑:

npm i -g git+ssh://git@github.com:stomvi/nextjs-postinstall-build.git

我将 next.js 用作本地 Web 服务器,作为 cli 工具的一部分。我想在安装工具后构建 next.js 服务器,所以我将next build脚本postinstall放在package.json. 安装失败并显示“您可能需要适当的加载程序来处理此文件类型,当前没有配置加载程序来处理此文件。” 错误。

使用-next.js v9.0.4-npm 6.9.0

该错误表明可能没有jsx文件加载器。本地npm link工作正常。

Failed to compile.

./pages/logs/[page].js 11:4
Module parse failed: Unexpected token (11:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
|   return (
>     <Layout>
|       <div className="card filter-container">
|         <div className="card-header">

> Build error occurred
Error: > Build failed because of webpack errors

我怎样才能使这项工作?目前我只是将目录提交.next到 repo 中。

标签: npmnext.jspost-install

解决方案


推荐阅读