Intlayer command undefined
Overview
The Intlayer CLI provides a convenient way to control your intlayer content, including building dictionaries, pushing translations, and more. However, it is not essential for your project to function. If you are using the bundler plugin (such as withIntlayer() for Next.js or intlayer() for Vite), Intlayer will automatically build dictionaries during the app build or development server startup. In development mode, it will also watch for changes and automatically rebuild content declaration files.
You can access the intlayer commands in different ways:
- Using the
intlayerCLI command directly - Using the VSCode extension
- Using the
@intlayer/cliSDK
Problem
When trying to use the intlayer command, you might encounter this error:
Copy the code to the clipboard
Solutions
Try these solutions in order:
- Verify the command is installed
Copy the code to the clipboard
Expected output:
Copy the code to the clipboard
- Install the intlayer-cli package globally
Copy the code to the clipboard
It should not be necessary if you've already installed the intlayer package
- Install the package globally
Copy the code to the clipboard
Restart your terminal Sometimes a terminal restart is needed to recognise new commands.
Clean and reinstall If the above solutions don't work:
Copy the code to the clipboard
Verify installation files If the issue persists, check that these files exist:
node_modules/intlayer/dist/cjs/cli.cjsnode_modules/intlayer/package.json(should have abinfield referencing./dist/cjs/cli.cjs)
Check PATH environment variable Make sure the npm global bin directory is in your PATH:
Copy the code to the clipboard
- Use npx with full path If the command is still not found, try using npx with the full path:
Copy the code to the clipboard
- Check for conflicting installations
Copy the code to the clipboard
- Verify Node.js and npm versions Make sure you're using compatible versions:
Copy the code to the clipboard
Copy the code to the clipboard
Check for permission issues If you are encountering permission errors:
bashCopy codeCopy the code to the clipboard