"Error: Error when loading extension html-to-xlsx@2.8.0",



  • What is it?

    "Error: Error when loading extension html-to-xlsx@2.8.0",
                            "Error: Cannot find module 'dayjs'",
                            "    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)",
                            "    at Function.Module._load (internal/modules/cjs/loader.js:562:25)",
                            "    at Module.require (internal/modules/cjs/loader.js:692:17)",
                            "    at require (internal/modules/cjs/helpers.js:25:18)",
                            "    at Object.<anonymous> (/opt/nodejs/node_modules/jsreport-exceljs/lib/csv/csv.js:4:15)",
                            "    at Module._compile (internal/modules/cjs/loader.js:778:30)",
                            "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
                            "    at Module.load (internal/modules/cjs/loader.js:653:32)",
                            "    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
                            "    at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
                            "    at Module.require (internal/modules/cjs/loader.js:692:17)",
                            "    at require (internal/modules/cjs/helpers.js:25:18)",
                            "    at Object.<anonymous> (/opt/nodejs/node_modules/jsreport-exceljs/lib/doc/workbook.js:6:13)",
                            "    at Module._compile (internal/modules/cjs/loader.js:778:30)",
                            "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
                            "    at Module.load (internal/modules/cjs/loader.js:653:32)",
                            "    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
                            "    at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
                            "    at Module.require (internal/modules/cjs/loader.js:692:17)",
                            "    at require (internal/modules/cjs/helpers.js:25:18)",
                            "    at Object.<anonymous> (/opt/nodejs/node_modules/jsreport-exceljs/lib/exceljs.nodejs.js:2:13)",
                            "    at Module._compile (internal/modules/cjs/loader.js:778:30)",
                            "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
                            "    at Module.load (internal/modules/cjs/loader.js:653:32)",
                            "    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
                            "    at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
                            "    at Module.require (internal/modules/cjs/loader.js:692:17)",
                            "    at require (internal/modules/cjs/helpers.js:25:18)",
                            "    at Object.<anonymous> (/opt/nodejs/node_modules/html-to-xlsx/lib/tableToXlsx.js:4:17)",
                            "    at Module._compile (internal/modules/cjs/loader.js:778:30)",
                            "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
                            "    at Module.load (internal/modules/cjs/loader.js:653:32)",
                            "    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
                            "    at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
                            "    at Object._useOne (/opt/nodejs/node_modules/jsreport-core/lib/extensions/extensionsManager.js:216:15)",
                            "    at Object._useMany (/opt/nodejs/node_modules/jsreport-core/lib/extensions/extensionsManager.js:98:20)
    

    My code

    const init = (async () => { 
    		jsreport = await JsReport({
    			//configFile: path.join(__dirname, './prod.config.json'),        
    			chrome: {
    				launchOptions: {
    					args: chromium.args,
    					defaultViewport: chromium.defaultViewport,
    					executablePath: await chromium.executablePath,
    					headless: chromium.headless,
    				}         
    			},
    
    			//dev-->
    			'httpPort': 5488,
    			'allowLocalFilesAccess': true,
    			'store': {
    				'provider': 'fs'
    			},
    			'blobStorage': {
    				'provider': 'fs',
    				'dataDirectory': '/tmp/storage'
    			},
    			'timeout': 60000,
    			'logger': {
    				'file': {
    					'silent': true
    				},
    				'error': {
    					'silent': true
    				}
    			},
    			'extensions': {
    				'authentication': {
    					'enabled': false
    				},
    				'authorization': {
    					'enabled': false
    				},
    				'cli': {
    					'enabled': false
    				},
    				'express': {
    					'enabled': false
    				},
    				'freeze': {
    					'enabled': false
    				},
    				'fs-store': {
    					'dataDirectory': '/tmp/data'
    				},
    				'import-export': {
    					'enabled': false
    				},
    				'public-templates': {
    					'enabled': false
    				},
    				'sample-template': {
    					'enabled': false
    				},
    				'studio': {
    					'enabled': false
    				},
    				'studio-theme-dark': {
    					'enabled': false
    				},
    				'tags': {
    					'enabled': false
    				},
    				'version-control': {
    					'enabled': false
    				}
    			}
    
    			//dev<--
    
    		})
    		await ncp(path.join(__dirname, '/data'), '/tmp/data')
    		return jsreport.init()
    
    	})()
    	const body = {
    		'template': {
    			'name': 'invoice-main',
    			'recipe': 'chrome-pdf'
    		},
    		'data': {
    			'data':[
    				{
    					'customerNr': 1,
    					'salutation': 2,
    					'nameCustomer': 2,
    					'additive': 2,
    					'street': 2,
    					'postCode': 2,
    					'city': 3333
    				}
    			]
    		}
    	}
    	await init
    	const res = await jsreport.render(body)
    

    my package.json

    {
      "name": "reports",
      "version": "1.0.0",
      "description": "",
      "scripts": {
        "start": "sls offline start",
        "deploy": "sls deploy",
        "jsreport": "jsreport"
      },
      "dependencies": {},
      "jsreport": {
        "entryPoint": "server.js"
      },
      "devDependencies": {
        "@apollo/federation": "^0.12.1",
        "apollo-server-lambda": "^2.10.0",
        "archiver": "3.0.0",
        "aws-sdk": "^2.544.0",
        "chrome-aws-lambda": "2.0.2",
        "dataloader-sequelize": "^2.0.0",
        "dateformat": "^3.0.3",
        "graphql-iso-date": "^3.6.1",
        "graphql-type-json": "^0.3.1",
        "ioredis": "^4.14.1",
        "jsonwebtoken": "^8.5.1",
        "jsreport": "^2.9.0",
        "jwk-to-pem": "^2.0.1",
        "modclean": "^3.0.0-beta.1",
        "mysql2": "^2.2.5",
        "ncp": "2.0.0",
        "request": "^2.88.0",
        "rimraf": "3.0.1",
        "sequelize": "^5.19.0",
        "serverless-offline-direct-lambda": "^0.0.1",
        "source-map-support": "^0.5.16"
      },
      "author": "",
      "license": "ISC"
    }
    
    
    

    Our company wants to buy your product! But we simply cannot implement your code ...

    By your example, everything works out!
    But it is not clear how to deploy it in other cases.



  • Your installation looks corrupted, try to delete node_modules folder and run npm install again.

    Although not an issue likely, note that you have dependencies listed in package.json devDependencies node where it should be likely in dependencies.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.