nva-server

raw JSON →
0.7.2 verified Mon Apr 27 auth: no javascript maintenance

nva-server is a frontend project development server that serves static content with features like asset serving, mock API configs, CORS support, and URL rewrites. It offers a command-line interface with options for port, host, content path, asset path, mock file, browser opening, and logging. Designed for development workflows, it integrates with the nva ecosystem. The package appears to have low maintenance based on sporadic releases, with the latest versions indicating ongoing but infrequent updates. It serves as an alternative to tools like http-server or serve with additional development-specific features.

error Error: Cannot find module 'nva-server'
cause Package not installed or name typo.
fix
Run 'npm install nva-server --save' (note hyphen, not underscore).
error SyntaxError: Cannot use import statement outside a module
cause Using ESM import syntax without 'type':'module' in package.json or .mjs extension.
fix
Add 'type':'module' to package.json, or use require if version <1.0.59.
error nva-server: command not found
cause Not installed globally or not in PATH.
fix
Install globally: npm install -g nva-server, or use npx nva-server.
error Missing option: -p
cause CLI parser expecting long options in newer version; -p may be removed.
fix
Use --port instead of -p.
breaking v1.0.59 introduced ESM-only support, breaking CJS require() usage.
fix Use import syntax or upgrade to supported versions.
deprecated The --config option may be deprecated in favor of nva-server.config.js file.
fix Refer to latest docs for configuration file approach.
gotcha CLI options changed between versions: -p vs --port etc. Use long options for compatibility.
fix Use full option names like --port, --content to ensure compatibility across versions.
gotcha Mock API feature requires proper file path; relative paths are resolved from current working directory.
fix Provide absolute path or ensure relative path is correct from CWD.
npm install nva-server
yarn add nva-server
pnpm add nva-server

Install the package, set environment variable for port, then run the CLI to serve ./public with CORS and logging enabled.

npm install nva-server --save
export PORT=5000
nva-server -p $PORT -c ./public --cors --log