I'm trying to get the no of pages from pdf using pdf2json.its thowing below error.
I'm using the webpack 5 and nodejs18
{
"errorType": "Error",
"errorMessage": "ENOENT: no such file or directory, open '/var/task/package.json'",
"code": "ENOENT",
"errno": -2,
"syscall": "open",
"path": "/var/task/package.json",
"stack": [
"Error: ENOENT: no such file or directory, open '/var/task/package.json'",
" at Object.openSync (node:fs:603:3)",
" at Object.readFileSync (node:fs:471:35)",
" at 61447 (/var/task/index.js:2:2588589)",
" at __webpack_require__ (/var/task/index.js:2:4081767)",
" at s (/var/task/index.js:2:2365892)",
" at new Promise (<anonymous>)",
" at /var/task/index.js:2:2365865",
" at Generator.next (<anonymous>)",
" at /var/task/index.js:2:2365505",
" at new Promise (<anonymous>)"
]
}
Need to calculate the page count for given pdf document. webpack 4 its working fine , after upgrade to nodejs18 and webpack 5 its not working,
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './src/lambda.ts',
target: 'node',
mode: 'production',
externals: [{ 'aws-sdk': 'commonjs aws-sdk' }],
module: {
rules: [
{
test: /\.(ts|tsx)?$/,
use: [
{
loader: 'ts-loader'
}
],
exclude: /node_modules/
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}
]
},
resolve: {
extensions: ['.wasm', '.mjs', '.tsx', '.ts', '.js', 'jsx', '.json']
},
output: {
filename: 'index.js',
hashFunction: 'xxhash64',
path: path.resolve(__dirname, 'webpacked'),
libraryTarget: 'commonjs2'
},
stats: { timings: true },
// plugins: [new webpack.IgnorePlugin(/^pg-native$/)],
ignoreWarnings: [
{ module: /sequelize/ },
{ module: /any-promise/ },
]
};