Skip to main content
This guide covers common issues you might encounter when using Devark and how to resolve them.

Common Issues

Problem: Devark cannot detect your package manager.
✔ Could not detect package manager.
Cause: Your project doesn’t have a lock file (package-lock.json, yarn.lock, pnpm-lock.yaml, or bun.lockb).Solution:
1

Initialize your project with a package manager

# For npm
npm install

# For yarn
yarn install

# For pnpm
pnpm install

# For bun
bun install
2

Re-run Devark

devark add <module-name>
Alternative: If you’re starting fresh, Devark will offer to initialize a project for you. Choose your preferred package manager when prompted.
Problem: Devark can’t find your entry file (app.js, src/app.ts, etc.).
✖ Entry file "app.js" not found.
Please create the entry file and run again.
Cause: The entry file you specified doesn’t exist in your project.Solution:
1

Create the entry file

For JavaScript:
touch app.js
For TypeScript:
mkdir -p src
touch src/app.ts
2

Add basic Express setup

app.js (JavaScript):
import express from 'express';

const app = express();

app.get('/', (req, res) => {
  res.send('Hello World!');
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});
src/app.ts (TypeScript):
import express, { Application, Request, Response } from 'express';

const app: Application = express();

app.get('/', (req: Request, res: Response) => {
  res.send('Hello World!');
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});
3

Re-run Devark

devark add <module-name>
For TypeScript projects, make sure your entry file is inside the src/ directory and uses the .ts extension.
Problem: Dependencies fail to install during module setup.
✖ Failed to install dependencies.
Common Causes:
  1. Network issues - npm registry is unreachable
  2. Outdated package manager - Using an old version
  3. Permission issues - Cannot write to node_modules
  4. Disk space - Not enough space for installation
Solutions:
1

Check network connection

Test if you can reach npm registry:
npm ping
2

Update your package manager

# For npm
npm install -g npm@latest

# For yarn
npm install -g yarn@latest

# For pnpm
npm install -g pnpm@latest

# For bun
curl -fsSL https://bun.sh/install | bash
3

Clear cache

# For npm
npm cache clean --force

# For yarn
yarn cache clean

# For pnpm
pnpm store prune

# For bun
rm -rf ~/.bun/install/cache
4

Install dependencies manually

Check the error message for which packages failed, then:
npm install <package-name>
5

Check permissions

If you get permission errors:
# Don't use sudo! Instead, fix npm permissions:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
Add the export line to your ~/.bashrc or ~/.zshrc.
Problem: Trying to add a module that’s already been added.
✖ This module appears to be already installed.
Cause: The module’s files (routes, config) already exist in your project.Solution:
1

Check existing files

# Look for module files
ls config/
ls routes/
2

Remove module files (if you want to reinstall)

# Example for google-oauth
rm config/googleStrategy.js
rm routes/googleAuthRoutes.js
Only remove files if you haven’t made custom changes. Back up first if unsure.
3

Clean up app.js imports

Remove module-related imports from your entry file:
// Remove lines like:
import googleAuthRoutes from './routes/googleAuthRoutes.js';
import './config/googleStrategy.js';
4

Re-run Devark

devark add <module-name>
Problem: Getting EACCES or EPERM errors.
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
Cause: Trying to install global packages without proper permissions.Solution:
1

NEVER use sudo with npm

Using sudo can cause permission issues. Instead, configure npm properly.
2

Change npm's default directory

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
3

Update PATH

Add to ~/.bashrc, ~/.zshrc, or ~/.profile:
export PATH=~/.npm-global/bin:$PATH
Then reload:
source ~/.bashrc  # or ~/.zshrc
4

Reinstall global packages

npm install -g devark
For pnpm users:
pnpm setup
source ~/.bashrc  # or ~/.zshrc
Problem: Git shows conflicts in app.js or other files.Cause: Devark modified files that you had uncommitted changes in.Solution:
1

Stash your changes before running Devark

git stash
devark add <module-name>
git stash pop
2

Resolve conflicts manually

If conflicts occur:
# Open the conflicting file
code app.js  # or vim, nano, etc.

# Look for conflict markers:
# <<<<<<< HEAD
# Your changes
# =======
# Devark's changes
# >>>>>>> 

# Keep both sets of changes, removing conflict markers
3

Test your app

npm start
# or
node app.js
4

Commit the resolved changes

git add .
git commit -m "feat: add <module-name> and resolve conflicts"
Problem: TypeScript errors after adding a module.
error TS2307: Cannot find module 'express' or its corresponding type declarations.
Cause: Type definitions are missing or tsconfig.json is misconfigured.Solution:
1

Install missing type definitions

npm install -D @types/express @types/node
# or for specific modules
npm install -D @types/passport @types/express-session
2

Check tsconfig.json

Ensure your tsconfig.json includes:
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "outDir": "./dist",
    "rootDir": "./src"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}
3

Rebuild the project

npx tsc
Problem: Node.js can’t find the module files that Devark created.
Error [ERR_MODULE_NOT_FOUND]: Cannot find module './routes/googleAuthRoutes.js'
Cause: File path mismatch or files weren’t created in the expected location.Solution:
1

Verify files were created

ls routes/
ls config/
# or for TypeScript
ls src/routes/
ls src/config/
2

Check import paths in app.js

For JavaScript (files in root):
import googleAuthRoutes from './routes/googleAuthRoutes.js';
For TypeScript (files in src/):
import googleAuthRoutes from './routes/googleAuthRoutes.js';
// Note: Still use .js extension, not .ts
3

Check package.json for type

Ensure you have:
{
  "type": "module"
}
This enables ES modules (import/export syntax).
4

Try absolute path temporarily

To debug, use absolute path:
import { fileURLToPath } from 'url';
import path from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const routesPath = path.join(__dirname, 'routes', 'googleAuthRoutes.js');
console.log('Looking for routes at:', routesPath);
Problem: OAuth credentials or other env vars aren’t being read.
ClientID: undefined
ClientSecret: undefined
Cause: .env file isn’t being loaded or is in the wrong location.Solution:
1

Check .env file exists

cat .env
Should show:
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
SESSION_SECRET=your-session-secret
2

Ensure dotenv is loaded early

At the top of your entry file:
import 'dotenv/config';
// All other imports after this
3

Check .env location

The .env file should be in your project root (same directory as package.json):
project/
├── .env          ← Here
├── package.json
├── app.js
└── ...
4

Debug env loading

Add debug logging:
import 'dotenv/config';
console.log('Env loaded:', {
  clientId: process.env.GOOGLE_CLIENT_ID,
  hasSecret: !!process.env.GOOGLE_CLIENT_SECRET
});
5

Check for .env in .gitignore

Ensure .env is in .gitignore (for security):
echo ".env" >> .gitignore
Problem: Can’t start server because port 3000 is already in use.
Error: listen EADDRINUSE: address already in use :::3000
Solution:
1

Find process using the port

# On Linux/Mac
lsof -i :3000

# On Windows
netstat -ano | findstr :3000
2

Kill the process

# On Linux/Mac
kill -9 <PID>

# On Windows
taskkill /PID <PID> /F
3

Or use a different port

Change in your app.js:
const PORT = process.env.PORT || 3001;
app.listen(PORT, () => {
  console.log(`Server running on http://localhost:${PORT}`);
});

Debug Mode

For advanced debugging, you can enable verbose logging:
# Set NODE_DEBUG environment variable
NODE_DEBUG=devark devark add google-oauth

# Or with more detail
DEBUG=* devark add google-oauth

Still Having Issues?

If your issue isn’t covered here, please report it on GitHub Issues with:
  • Devark version (devark --version)
  • Node.js version (node --version)
  • Package manager and version
  • Full error message
  • Steps to reproduce

Reporting Bugs

Found a bug? Help us fix it!
1

Search existing issues

Check if the bug has already been reported: https://github.com/huzfm/Devark/issues
2

Create a new issue

If not found, create a new issue with:Title: Brief descriptionDescription:
  • What you were trying to do
  • What happened
  • What you expected to happen
Environment:
- OS: [e.g., Ubuntu 22.04, macOS 13, Windows 11]
- Node.js version: [e.g., 18.16.0]
- Package manager: [e.g., npm 9.5.0]
- Devark version: [e.g., 1.1.1]
Steps to reproduce:
  1. Run devark add google-oauth
  2. Select JavaScript
Error message:
Paste full error here
3

Include relevant files

If possible, include:
  • Your package.json
  • Your app.js/app.ts (with sensitive data removed)
  • Screenshots of the error

Getting Help

Need help beyond troubleshooting?

GitHub Issues

Report bugs and request features

GitHub Discussions

Ask questions and share ideas

Quick Fixes Summary

IssueQuick Fix
Package manager not detectedRun npm install to create package-lock.json
Entry file not foundCreate app.js or src/app.ts
Permission errorsConfigure npm prefix: npm config set prefix '~/.npm-global'
Module not foundCheck "type": "module" in package.json
Env vars not loadingAdd import 'dotenv/config' at top of entry file
Port in useUse different port or kill process on port 3000
TypeScript errorsInstall missing @types: npm i -D @types/express @types/node
Always backup your project before troubleshooting, especially when manually editing files or removing modules.

Next Steps

Module Structure

Understand how modules work

Contributing

Help improve Devark

Build docs developers (and LLMs) love