我正在尝试在 Netlify 上部署我的 Storybook,我使用的是 Next.js 框架,但每次都失败,我不知道出了什么问题
Netlify 配置:
构建命令:npm run build-storybook
发布目录:storybook-static
我的 package.json:
{
"homepage": "https://github.com/alexCoding42/tailwind-storybook",
"name": "tailwind-storybook",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"dependencies": {
"next": "10.0.9",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@netlify/plugin-nextjs": "^3.0.3",
"@storybook/addon-actions": "^6.2.0-alpha.22",
"@storybook/addon-essentials": "^6.2.0-alpha.22",
"@storybook/addon-links": "^6.2.0-alpha.22",
"@storybook/react": "^6.2.0-alpha.22",
"@types/node": "^14.14.35",
"@types/react": "^17.0.3",
"babel-loader": "^8.2.2",
"gh-pages": "^3.1.0",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.2.1",
"tailwindcss": "^2.0.4",
"typescript": "^4.2.3"
}
}
我在 Netlify 上遇到的错误:
Plugin "@netlify/plugin-nextjs" internal error
Error: No static assets found in .next dist (aka no /.next/static). Please check your project configuration. Your next.config.js must be one of serverless or experimental-serverless-trace. Your build command should include next build.
我还尝试使用此配置在我的项目的根目录中添加一个 netlify.toml
:
[build]
command = "npm run build-storybook"
publish = "storybook-static"
[[plugins]]
package = "@netlify/plugin-nextjs"
并添加了 @netlify/plugin-nextjs
作为 package.json 的开发依赖项,但我得到了同样的错误...
有人可以帮我吗?
答案 0 :(得分:0)
故事书构建不需要 Netlify Next.js 插件。事实上,不需要插件;正如 OP 所说,唯一需要的配置是:
构建命令:#akka.action.default-dispatcher.executor = "fork-join-executor" akka.action.default-dispatcher.executor = "thread-pool-executor"
#akka.action.default-dispatcher.throughput = 100 akka.action.default-dispatcher.thread-pool-executor.fixed-pool-size = 300
#akka.action.default-dispatcher.thread-pool-executor.core-pool-size-min = 2
#akka.action.default-dispatcher.thread-pool-executor.core-pool-size-factor = 2.0
#akka.action.default-dispatcher.thread-pool-executor.core-pool-size-max = 10
#akka.action.default-dispatcher.fork-join-executor.parallelism-max = 24
akka.http.host-connection-pool.max-connections = 20
发布目录:npm run build-storybook
或者,在 storybook-static
中:
netlify.toml
不需要 [build]
command = "npm run build-storybook"
publish = "storybook-static"
字段。
如果 Netlify 是通过 UI 配置的,请转到 https://app.netlify.com/sites/my-awesome-site/plugins 并删除 Next.JS 插件。