Error with chalk module installing Vue-cli - npm

Configuring VUE-CLI I am having the next problem:
internal/modules/cjs/loader.js:596
throw err;
^
Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/usr/local/bin/vue:3:15)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
I have tried to install the module globally but with the same result, when I type in the terminal vueerror appears again.
Could you tell me please how to fix this problem?

It was fixed adding the correct PATHS in the .zshrc file, I was adding them to the bash_profile but I am working with other shell.

see the error "Error: Cannot find module 'chalk'"
try
npm install chalk

Related

Vue Cli: Cannot find module '../package.json' error after npm install

I am not an expert in Vuejs or Vuecli, but I do manage to get stuff working.
I had a project i worked on before using Vuecli3 and webpack and now when I opened it after few weeks to make changes, i get the below error in dev mode
$ vue-cli-service serve --open --mode development --dashboard
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '../package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Volumes/Drobo/Dropbox/NASDAQ Dubai/Marketdata-6-Indices/node_modules/.bin/vue-cli-service:5:25)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
Total task duration: 0.15s
The package.json file is right there in the root director and also the .lock file. Dont know what is the reason for this error in compiling.
Any help hightly appreciated
As #vesperknight mentioned in the comment, this issue tends to happen when you move the project's folder to another location.
To solve this (on Linux), from the root directory of your project:
Delete existing node modules.
rm -r node_modules
Reinstall all dependencies:
npm install
The first step seems to be important.

Error: Cannot find module 'wrappy'

When I try to restore my packages via yarn I'm receiving the following error:
npm run yarn --ignore-platform --ignore-optional
...
error C:\Users\mdepouw\source\repos\MyRepo\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/install.js
Arguments:
Directory: C:\Users\mdepouw\source\repos\MyRepo\node_modules\node-sass
Output:
module.js:471
throw err;
^
Error: Cannot find module 'wrappy'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\mdepouw\source\repos\MyRepo\node_modules\inflight\inflight.js:1:76)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
When I a npm install it works fine.
Why does one work but not the other?
This usually happens when you update npm. To resolve this go to path "C:\Users[username]\AppData\Roaming" and delete "npm" and "npm-cache" folders. Then uninstall nodejs and reinstall using updated installer. This should solve your problem.

Error starting up React Native packager "Cannot find module metro-bundler"

I have a simple React Native project that works fine on the original machine I created it on, but when I clone the git repo on another machine and try to run the iOS project, I get this error when starting the packager:
module.js:471
throw err;
^
Error: Cannot find module 'metro-bundler/build/lib/formatBanner'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (.../node_modules/react-native/local-cli/server/checkNodeVersion.js:12:20)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Process terminated. Press <enter> to close the window
The project is on GitHub here. I purposely didn't git ignore the node_modules folder because this project has some slight modifications to React Native itself. It seems if I delete node_modules and yarn install it resolves the issue but I'd like to have the GitHub repo in a state where you can clone and you don't need to run anything to set up dependencies.

Error: Cannot find module '../'

I got an error after copying a running project into another folder.
My setup:
vue init webpack-simple foo
cd foo
npm install
npm run dev
This works as expected: My browser opens and shows the typical vue index page.
Now let's suppose that I'm on a train with no internet and want to create another project from foo:
If I copy foo into bar and go to the directory and run npm run dev I got the following error:
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/fer/wokspace/udemy/foo/node_modules/.bin/cross-env:4:9)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
Why is this happening? The error does not happen if I move the folder instead of copy it

Error running Gulp in Sylius

I've got a new install of Sylius that I'm working with. I just installed NPM and Gulp, and wanted to run Gulp for the first time. I'm getting an error, and have never worked with Gulp or Sylius before, so it's a little hard for me to understand:
gulp
module.js:328
throw err;
^
Error: Cannot find module 'gulp-if'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/www/mysite.com/public_html/Gulpfile.js:2:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
This is happening on a Ubuntu system, but it also seems to be throwing the same error on my Mac, with a copy of the same Sylius install on it.
try running npm i -S gulp-if in your project. What this does is install the gulp-if package and saves it in your package.json file