尝试将 Next.js 应用程序部署到 Zeit 云时出错,运行 处于开发模式

Error when attempting to deploy Next.js app to Zeit cloud, running in dev mode

我无法使用 now 命令将我的 Next.js 应用程序部署到 Zeit。

我尝试卸载 sass 重新安装 npm i node-sass 以及 npm i node-sass --force。 None 这行得通。我收到以下错误。

Node Sass could not find a binding for your current environment: OS X 64-bit with Node XX.X.X

应用程序必须部署或至少 运行 处于开发模式 'now dev'。当我 运行 'npm run dev'.

时,它 运行 在我的本地开发环境中很好

我是如何解决这个问题的,我写了一个 bash 脚本来执行以下步骤。

# Delete build files

sudo rm -rd .next

# Delete node modules

sudo rm -rd node_modules

# Then I ran this without installing the node_modules again

now dev

当我让 zeit 构建器安装 node_modules 时,测试部署非常有效。