This guide helps you resolve common issues when working with the TypeScript Excel development environment.
Symptoms:
- Docker build fails with error messages
- Container doesn't start properly
Solutions:
-
Check Docker is running
docker --version docker ps
-
Check available disk space
df -h
-
Clear Docker cache
docker system prune -a
-
Rebuild from scratch
docker build --no-cache -t typescript-excel-dev .
Symptoms:
- Node.js or TypeScript not found
- npm commands fail
Solutions:
-
Check if the container built completely
docker logs <container-id>
-
Verify the Dockerfile
- Ensure all RUN commands completed successfully
- Check for any error messages in the build logs
-
Rebuild the container
docker build -t typescript-excel-dev .
Symptoms:
- No "Reopen in Container" prompt
- Dev Container extension not working
Solutions:
-
Install Dev Containers extension
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Dev Containers"
- Install the extension
-
Check devcontainer.json
- Ensure the file is in the correct location
- Validate JSON syntax
-
Reload VS Code
- Close VS Code
- Reopen the project folder
Symptoms:
- VS Code extensions listed in devcontainer.json don't install
- Missing functionality in the container
Solutions:
-
Check extension IDs
- Ensure all extension IDs are correct
- Remove any invalid extensions
-
Rebuild the container
# In VS Code: Ctrl+Shift+P -> "Dev Containers: Rebuild Container" -
Check VS Code logs
- Help -> Toggle Developer Tools
- Check the Console for error messages
Symptoms:
- TypeScript compiler errors
- Missing type definitions
Solutions:
-
Install Office.js types
npm install --save-dev @types/office-js
-
Check tsconfig.json
- Ensure Office.js types are included
- Verify module resolution settings
-
Update dependencies
npm update
Symptoms:
- Build errors
- Type checking failures
Solutions:
-
Check TypeScript version
tsc --version
-
Verify tsconfig.json
- Check compiler options
- Ensure all required files are included
-
Clear TypeScript cache
rm -rf node_modules/.cache npm run build
Symptoms:
- Office.js API not available
- Runtime errors
Solutions:
-
Check Office.js CDN
- Ensure the CDN is accessible
- Try a different CDN URL
-
Verify Office environment
- Ensure you're running in an Office application
- Check the manifest.xml file
-
Check browser console
- Look for JavaScript errors
- Verify network requests
Symptoms:
- Excel.run() throws errors
- Operations don't complete
Solutions:
-
Check Excel context
Office.onReady((info) => { if (info.host === Office.HostType.Excel) { // Excel-specific code } });
-
Verify permissions
- Check the manifest.xml permissions
- Ensure required APIs are declared
-
Add error handling
try { await Excel.run(async (context) => { // Your operations }); } catch (error) { console.error('Excel operation failed:', error); }
Symptoms:
- Build errors
- Missing modules
Solutions:
-
Check webpack configuration
- Verify entry points
- Check module rules
-
Install missing dependencies
npm install
-
Clear build cache
rm -rf dist/ npm run build
Symptoms:
- npm run dev-server fails
- Port already in use
Solutions:
-
Check port availability
netstat -tulpn | grep :3000 -
Kill existing processes
pkill -f webpack
-
Use a different port
npm run dev-server -- --port 3001
Symptoms:
- npm test fails
- Jest not found
Solutions:
-
Install Jest
npm install --save-dev jest @types/jest ts-jest
-
Check Jest configuration
- Verify jest.config.js
- Check test file patterns
-
Run tests individually
npx jest src/test-file.test.ts
Symptoms:
- Playwright tests don't run
- Browser not found
Solutions:
-
Install Playwright browsers
npx playwright install
-
Check Playwright configuration
- Verify playwright.config.js
- Check browser settings
-
Run with debug mode
npx playwright test --debug
// Enable Office.js debugging
Office.debug = true;
// Enable verbose logging
console.log('Debug mode enabled');# Get container ID
docker ps
# View logs
docker logs <container-id>
# Follow logs
docker logs -f <container-id>- Set breakpoints in your TypeScript code
- Press F5 to start debugging
- Use the debug console to inspect variables
- Check the call stack for error locations
# Test network connectivity
ping google.com
# Check DNS resolution
nslookup google.com
# Test Office.js CDN
curl -I https://appsforoffice.microsoft.com/lib/1/hosted/office.jsSolutions:
-
Use Docker layer caching
docker build --cache-from typescript-excel-dev . -
Optimize Dockerfile
- Combine RUN commands
- Remove unnecessary packages
-
Use multi-stage builds
- Separate build and runtime stages
Solutions:
-
Enable webpack caching
module.exports = { cache: true, // ... other config };
-
Use TypeScript incremental compilation
{ "compilerOptions": { "incremental": true, "tsBuildInfoFile": ".tsbuildinfo" } } -
Parallelize builds
npm run build -- --parallel
-
VS Code Output Panel
- View -> Output
- Select "Dev Containers" from dropdown
-
Docker Logs
docker logs <container-id>
-
Application Logs
- Check browser console
- Check terminal output
-
Office Add-ins Community
-
Stack Overflow
- Tag questions with
office-js,excel-addin,typescript
- Tag questions with
-
GitHub Issues
When reporting issues, include:
-
Environment details
- OS version
- Docker version
- VS Code version
- Extension versions
-
Steps to reproduce
- Detailed steps
- Expected vs actual behavior
-
Logs and error messages
- Console output
- Error messages
- Screenshots if applicable
-
Project files
- package.json
- tsconfig.json
- webpack.config.js
- Any relevant code
Still having issues? Don't hesitate to ask for help in the community forums! 🆘