Skip to content

Troubleshooting cloudpack start

Adblockers

We've seen cases where ad-blockers prevent the cloudpack start command from working properly. If you have an ad-blocker installed, try disabling it and running the command again.

System limit of file watchers

If you see an error message like this:

txt
Error: ENOSPC: System limit for number of file watchers reached

and you are using VS Code, you can try to free some used watchers with the following configuration in your VS Code User Settings:

json
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/*/**": true,
    "**/.yarn/**": true
  },

If that doesn't work, you can increase the number of watchers with the following command:

sh
echo fs.inotify.max_user_watches=131070 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

If the limit is still reached, you can increase it further by changing the number in the command above.

"Dynamic require is not supported"

If you see an error message like this:

txt
Uncaught Error: Dynamic require of "package" is not supported

This is likely a package that declares an ESM entry that imports a CJS file with a require() (learn more about module formats). Cloudpack uses Ori to bundle ESM packages by default, but it doesn't support dynamic requires.

You can fix this by switching the bundler to rspack, webpack or rollup in your cloudpack.config.json:

json
{
  "packageSettings": [
    {
      "name": "package-name",
      "bundler": "rspack"
    }
  ]
}

"TypeError: package-name is not a function/constructor/others"

If you see an error message like this:

txt
TypeError: package-name is not a function

What's happening:

This error occurs when importing CommonJS (CJS) modules using incorrect ES module import syntax. The issue is that different import patterns access the module exports differently.

This issue is most common with older packages that weren't designed for ESM compatibility. Consider reaching out to the package maintainer to add proper ESM support.

The problem:

js
// This often fails with CJS modules
import * as LRUCache from 'lru-cache'
new LRUCache({ max: 100 }) // TypeError: LRUCache is not a constructor

// Because the actual constructor is nested under 'default'
console.log(LRUCache) // { default: [class LRUCache], ... }

Solutions:

1. Use default import instead of namespace import

js
// Instead of
import * as LRUCache from 'lru-cache'

// Use
import LRUCache from 'lru-cache'
new LRUCache({ max: 100 }) // ✅ Works

2. Access the default property explicitly

js
// If you must use namespace import
import * as LRUCache from 'lru-cache'
const Cache = LRUCache.default ?? LRUCache // Fallback to namespace import if default is not available
new Cache({ max: 100 }) // ✅ Works

3. Switch to a different bundler and inline the dependency

If import syntax changes don't work, try inlining the dependency and switching to a bundler that supports CJS better, like rspack or webpack:

json
{
  "packageSettings": [
    {
      "match": "package-name",
      "bundler": "rspack",
      "inlinedDependencies": ["problematic-package-name"]
    }
  ]
}