Nuxt: Command 'nuxt' not found - Output directory `dist/` does not exists

9.8k views Asked by At

I have successfully created a Nuxt.js project with this configuration using the CLI:

Project name: test
Programming language: JavaScript
Package manager: Npm
UI framework: None
Nuxt.js modules: None
Linting tools: None
Testing framework: None
Rendering mode: Single Page App
Deployment target: Static (Static/JAMStack hosting)
Development tools: jsconfig.json
Version control system: Git

The developement server runs properly with npm run dev. npm run build also runs without errors and tells me that:

Ready to run nuxt generate 

But the execution of nuxt generate leads to the error Command 'nuxt' not found. This is strange because nuxt seems to be installed when I execute npm nuxt list.

nuxt not found

I first reinstalled just nuxt and then all dependencies after deleting the node_modules/ folder, but the error remains the same. If I just run npm run start it tells me

Nuxt Fatal Error
Error: Output directory `dist/` does not exists, please use
`nuxt generate` before `nuxt start` for static target. 

This is strange again because the .nuxt/dist/ folder exists. Does anyone have an idea what is going wrong?

dist/ does not exist

dist/ exists

1

There are 1 answers

0
Tom On

I have solved the problem. For me it works if I run npm run generate instead of nuxt generate.