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

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.

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.

Titanium - new versions

I created an app with Titanium, 2 years ago. I want to develop a new one, but from the beginning, it doesn't work.
I just updated the SDK to 7.4.0GA, and, when I run the command "ti create" in my console, there is an error :
[ERROR] Failed to load command "create"
[ERROR] SyntaxError: Unexpected token ...
at Object.<anonymous> (...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\lib\exception.js:33:27)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.defineProperty.get (...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\lib\appc.js:63:11)
at ...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\dist\async.js:2111:9
at apply (...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\dist\async.js:21:25)
at ...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\dist\async.js:56:12
at _insert (...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\dist\async.js:2220:9)
at Object.q.push (...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\node_modules\async\dist\async.js:2267:13)
at Object.findExecutable (...\AppData\Roaming\npm\node_modules\titanium\node_modules\node-appc\lib\subprocess.js:113:8)
at resolveNode (...\AppData\Roaming\npm\node_modules\titanium\lib\titanium.js:97:34)
at ...\AppData\Roaming\npm\node_modules\titanium\lib\titanium.js:74:5
at Object.<anonymous> (...\AppData\Roaming\npm\node_modules\titanium\lib\titanium.js:80:2)
I also tried with SDK 7.3.1.GA
What can I do ?
Thanks a lot :)
Update your CLI tools. Run npm install -g titanum appcelerator alloy and appc setup to check the environment.
After that ti create or appc ti create should work

Error with chalk module installing Vue-cli

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

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