Fix Excel Office Add-in Error: LRU Cache Is Not a Constructor
Question details
User is experiencing an 'LRU Cache is not a constructor' error during the npm start process for an Excel add-in.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Developing or testing a custom Excel add-in created with the Yeoman generator after running a package update.
- Observed behavior
- The development server fails to start, throwing an error that states LRU Cache is not a constructor when running npm start.
Ensure you have your exact error logs saved, note your current Node.js and npm versions, and document the specific packages that were recently updated before troubleshooting.
Troubleshoot Dependencies and Seek Developer Support
Attempt to resolve the node package conflicts locally, and if the issue persists, escalate it to the Microsoft Office development team.
This error is typically caused by a breaking change or version mismatch in the `lru-cache` npm package dependency within your Node.js environment. Resetting your packages or seeking official developer guidance is the best path forward.
Open your terminal, delete your `node_modules` folder and `package-lock.json` file. Run `npm cache clean --force` followed by `npm install` to ensure a clean dependency installation.
If the error persists, identify the version of `lru-cache` that was working previously. Update your `package.json` to lock this specific older version and run `npm install` again.
Document your Node.js version, operating system details, Yeoman generator version, and the complete error stack trace from your terminal.
Visit the official Microsoft Q&A website and navigate to the Office Development section. Create a new question detailing your environment, reproduction steps, and error logs so the Office add-in development team can investigate the dependency change.

Try WPS Office for a Seamless Spreadsheet Experience
If you are dealing with persistent development or compatibility issues in Microsoft Excel, consider switching to WPS Office. It offers a lightweight, robust, and highly compatible environment for all your spreadsheet and data analysis needs.
- 1. Download and install: Visit the WPS Office website, download the free installer, and follow the on-screen instructions to set up the software.
- 2. Launch WPS Spreadsheet: Open WPS Office and select the Spreadsheet module to start a new workbook or open an existing one.
- 3. Open existing Excel files: Drag and drop your current `.xlsx` files into the WPS interface to continue working seamlessly without formatting loss.

Frequently Asked Questions
What causes the 'LRU Cache is not a constructor' error?
This error generally occurs when there is a mismatch or a breaking code change in the `lru-cache` npm package dependency, often triggered immediately after running a package update in a Node.js project.
How can I check my current npm package versions?
Open your command line interface in your project directory and run `npm list` to see a tree of all installed packages, or use `npm list lru-cache` to check the exact version causing the conflict.
Where is the best place to report Microsoft Office add-in bugs?
The official Microsoft Q&A platform under the 'Office Development' section is the recommended channel. Providing your Yeoman project details and error logs will help their team diagnose the issue quickly.
Can I build customized tools for WPS Office?
Yes, WPS Office supports various developer tools and APIs, including macros and VBA equivalents, allowing advanced users to build customized analytical tools and automate workflows.




