I’m trying to deploy my site, this was working until I decided to add in the eleventy config for ‘algoliasearch’
This configuration is working on my local pc . but when I deploy it to Netlify, it errors with
Error: Cannot find module ‘algoliasearch’
details as below:
┌───────────────────────────────────┐
8:15:39 PM: │ 1. Build command from Netlify app │
8:15:39 PM: └───────────────────────────────────┘
8:15:39 PM:
8:15:39 PM: $ eleventy --serve
8:15:39 PM: Eleventy fatal error: (more in DEBUG output)
8:15:39 PM: > Error in your Eleventy config file '/opt/build/repo/.eleventy.js'. You may need to run `npm install`.
8:15:39 PM: `EleventyConfigError` was thrown
8:15:39 PM: > Cannot find module 'algoliasearch'
8:15:39 PM: Require stack:
8:15:39 PM: - /opt/build/repo/.eleventy.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateConfig.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/Config.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateEngineManager.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/EleventyExtensionMap.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateRender.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateData.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/Eleventy.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/cmd.js
8:15:39 PM: `Error` was thrown:
8:15:39 PM: Error: Cannot find module 'algoliasearch'
8:15:39 PM: Require stack:
8:15:39 PM: - /opt/build/repo/.eleventy.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateConfig.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/Config.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateEngineManager.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/EleventyExtensionMap.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateRender.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/TemplateData.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/src/Eleventy.js
8:15:39 PM: - /opt/build/repo/node_modules/@11ty/eleventy/cmd.js
8:15:39 PM: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
8:15:39 PM: at Function.Module._load (internal/modules/cjs/loader.js:842:27)
8:15:39 PM: at Module.require (internal/modules/cjs/loader.js:1026:19)
8:15:39 PM: at require (internal/modules/cjs/helpers.js:72:18)
8:15:39 PM: at Object.<anonymous> (/opt/build/repo/.eleventy.js:2:23)
8:15:39 PM: at Module._compile (internal/modules/cjs/loader.js:1138:30)
8:15:39 PM: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
8:15:39 PM: at Module.load (internal/modules/cjs/loader.js:986:32)
8:15:39 PM: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
8:15:39 PM: at Module.require (internal/modules/cjs/loader.js:1026:19)
However, this is working on my local machine . I’m new to this, so please do help me or let me know how to begin to fix this error !!
Many thanks,
Chandan.