I am getting an error about distDir. My next.config.js does not specify a value for distDir. Is there something I am missing?
2:13:43 PM: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
2:13:43 PM: at validateString (internal/validators.js:120:11)
2:13:43 PM: at join (path.js:1039:7)
2:13:43 PM: at getNextDistDir (/opt/build/repo/node_modules/next-on-netlify/lib/helpers/getNextDistDir.js:8:10)
2:13:43 PM: at Object.<anonymous> (/opt/build/repo/node_modules/next-on-netlify/lib/config.js:21:23)
2:13:43 PM: at Module._compile (internal/modules/cjs/loader.js:1138:30)
2:13:43 PM: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2:13:43 PM: at Module.load (internal/modules/cjs/loader.js:986:32)
2:13:43 PM: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2:13:43 PM: at Module.require (internal/modules/cjs/loader.js:1026:19)
2:13:43 PM: at require (internal/modules/cjs/helpers.js:72:18) {
2:13:43 PM: code: 'ERR_INVALID_ARG_TYPE'
2:13:43 PM: }
It looks like you got this fixed yesterday! If you are able to, would you mind sharing what change fixed this? This would be helpful for future Forums members who find themselves in a similar situation.
Hey @hillary!
I made it so we don’t use the next-on-netlify npm package but rather just use the netlify/plugin-nextjs package specified on the netlify.toml
I think Netlify’s docs and blog posts should be updated to link back to that page as the latest and easiest way of doing it now
Caveat:
I did end up losing the ability to connect to postgres for now though. Given we use the pg package to connect and that doesn’t work right now I had to add in my next.config.js some code to ignore pg-native in the webpack config
if (!dev) {
config.plugins.push(new webpack.IgnorePlugin(/^pg-native$/))
}
Thanks for sharing, @qb3l I really appreciate you taking the time to write this out. It will definitely be beneficial should future Forums members encounter something similar.
Are you still experiencing this postgres issue? If so, let me know and I can get a member of the Support team to dig into that further.
Hey @Scott !
That is basically the “solution” I put up in a comment above to fix the build but postgres is still broken when you try to use it. Presumably because something that is needed is not there or some other issue.