-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Challenges Installing and Using Library in Next.js 14 #145
Comments
What does this have to do with |
@mmomtchev |
This is likely a problem with your configuration and not Post the errors you are getting. |
Yes, I encounter errors when I use the library, not when installing it and running the application:
|
The problem is const binding_path = binary.find(path.resolve(path.join(__dirname, '../package.json')))
const gdal = require(binding_path) (from If you hardcode the binary path as Check those links: I remember that I had to improve the |
@agusoler000 if you can't find a proper solution, maybe the cleanest method would be to replace the |
@mmomtchev could my error be related to the issue you described above?
import path from 'path';
import gdal from 'gdal-async';
import { NextResponse } from 'next/server';
export async function GET({ params }: { params: { userId: string } }): Promise<NextResponse> {
try {
const dataset = await gdal.openAsync(
path.resolve('C:\\NationalCSB_2016-2023_rev23\\CSB1623.gdb'),
);
const layer = dataset.layers.get(0);
console.log('number of features: ' + layer.features.count());
console.log('fields: ' + layer.fields.getNames());
console.log('extent: ' + JSON.stringify(layer.extent));
console.log('srs: ' + (layer.srs ? layer.srs.toWKT() : 'null'));
return NextResponse.json([], { status: 200 });
} catch (e) {
console.error(e);
return NextResponse.json([], { status: 500 });
}
} |
@mmomtchev made a quick demo for you to clone: https://github.com/ProductOfAmerica/test-gdal |
You are webpacking You have certainly something in your Try with this /** @type {import('next').NextConfig} */
export default {
webpack: (config) => {
const externals = ['gdal-async'];
if (config.externals)
config.externals.push(...externals);
else
config.externals = externals;
return config;
}
}; Plain |
@mmomtchev I guess ignore the express errors. You solved my nextjs problem, so thank you! |
I'm facing multiple challenges while attempting to install and utilize a library in my Next.js 14 project. Here's a comprehensive overview of the encountered errors:
Module Resolution Errors: I'm consistently receiving "Module not found" errors for various modules such as npm, nock, and others. These modules are crucial for my project's functionality, but the errors persist despite their installation and presence in the project's dependencies.
HTML Loader Configuration: There seems to be a misconfiguration or absence of proper HTML loader configuration, leading to errors during the webpack compilation process. These errors specifically pertain to the handling of HTML files within the project.
Missing package.json Error: Additionally, there's an error indicating the absence of package.json, which should exist in the expected directory. This missing file might be contributing to the module resolution issues and further complicating the webpack compilation.
Webpack Compilation Errors: During the webpack compilation phase, I'm encountering errors related to missing modules such as npm and nock. These errors halt the compilation process and prevent the successful building of the project.
Despite attempts to reinstall dependencies, review webpack configurations, and ensure proper Next.js setup, these issues persist. I'm seeking guidance and assistance on resolving these errors and effectively integrating the library into my Next.js 14 project.
Any insights or suggestions from the community would be immensely appreciated.
Thank you for your support!
The text was updated successfully, but these errors were encountered: