after trying to update vue cli to its latest version using npm update, now everytime I run vue it throws the following error:
vue create
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'strip-ansi'
Require stack:
- /usr/lib/node_modules/@vue/cli/node_modules/@vue/cli-shared-utils/lib/logger.js
- /usr/lib/node_modules/@vue/cli/node_modules/@vue/cli-shared-utils/index.js
- /usr/lib/node_modules/@vue/cli/bin/vue.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/usr/lib/node_modules/@vue/cli/node_modules/@vue/cli-shared-utils/lib/logger.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/lib/node_modules/@vue/cli/node_modules/@vue/cli-shared-utils/lib/logger.js',
'/usr/lib/node_modules/@vue/cli/node_modules/@vue/cli-shared-utils/index.js',
'/usr/lib/node_modules/@vue/cli/bin/vue.js'
]
}
Node.js v17.3.0
If I try to uninstall the package, I also get an error:
sudo npm uninstall -g @vue/cli
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/@vue/cli
npm ERR! dest /usr/lib/node_modules/@vue/.cli-kgOlUxFE
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/lib/node_modules/@vue/cli' -> '/usr/lib/node_modules/@vue/.cli-kgOlUxFE'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-17T17_58_23_457Z-debug-0.log
I don't know what to do, I need vue cli working
Thanks in advance
CodePudding user response:
You can try to remove the node_modules
folder and install all dependencies again with npm install
.
CodePudding user response:
Removing the node_modules
folder broke my npm installation completely. Don't do it. I had to reinstall nodejs to make it work again.