Error in running nuxt project: "'nuxt' is not recognized as an internal or external command"

I solved this problem.
I was looking in stackoverflow for similar problems and apparently the problem was the npm cache.
I will let a link bellow with the solution and a quick sample of what i did.

Link to the answer: npm ERR! code ELIFECYCLE

Step 1: npm cache clean --force

Step 2: Delete node_modules by $ rm -rf node_modules folder or delete it manually by going into the directory and right-click > delete. Delete package-lock.json file too.

Step 3: npm install

To start again, npm start

Thanks everyone who take time to help, really appreciate.


Make sure nuxt is installed in your Nuxt project:

$ cd /path/to/nuxt-project
$ npm list nuxt
[email protected] /path/to/nuxt-project
└── [email protected] 

Here /path/to/nuxt-project contains your package.json and node-modules.

If it isn't installed, add nuxt to your project by doing:

$ npm install --save nuxt

Or put it in your project's package.json then do npm install:

  "dependencies": {
    "nuxt": "^2.0.0"
  },

UPDATE:
If you are still getting "nuxt not recognized" problems, try to use explicit path to nuxt from your node_modules directory.

Given this directory (after doing npm install --save nuxt):

nuxt-project
|- node_modules
   |- .bin
      |- nuxt
|- package.json

Update the dev command in package.json with:

"scripts": {
  "dev": "node_modules/.bin/nuxt"
},

Sometimes this blows up because you're not exporting node_modules/.bin directory.

Place the following line in your .bashrc or .zshrc:

export PATH=node_modules/.bin:$PATH

Tags:

Vue.Js

Nuxt.Js