React-native start - node.js

Following the instructions for initial setup I stucked when found a red screen with:
ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the
generated bundle)
After reloading it changes and becomes:
Unable to download JS bundle
Than I found an advice for typing react-native start into the console. The result:
react-native start
/local/react_native/android_program1/node_modules/react-native/local-cli/cli.js:74 const setupEnvScript = /^win/.test(process.platform) ^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.require.extensions.(anonymous function) [as .js] (/local/react_native/android_program1/node_modules/react-native/node_modules/babel-core/node_modules/babel-register/lib/node.js:142:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/local/react_native/android_program1/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
I'm using:
RHEL 7, npm 1.3.6, nodejs 0.10.36 and react-native 0.19.
How can I make it work?

install node js
open command promt.
type: react-native init projectName
this command will automatically download all the required dependancies for project.
open the directory from cmd using cd projectname
react-native run-android
if u face the error like : make sure you have npm install.
then just exicute this command
npm install --save
your project will run successfully.
hope it work for you..

Related

Gulp watch not working - cannot find module connect

Trying to run my project using gulp (havent used gulp before and have inherited an exisiting project).
I install the dependencies into the wordpress theme directory.
Running gulp watch throws this error:
Error: Cannot find module 'connect'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\dev\projects\romac-website\web\app\themes\romac\node_modules\browser-sync\lib\utils.js:307:31)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I have tried to update npm but not sure if it is fine or the problem (still).
I also tried to ins install this module with npm -g install connect
What should I try next?
Try deleting the node-modules folder then reinstall npm install connect --save-dev Then retry running gulp

I cant run ionic serve

Can somebody help me? I'm new in ionic. When I try to run serve, this error appears. I ran sudo npm install -g cordova, but the error came back.
Error: Cannot find module 'xmlbuilder'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:12:13)
at Object. (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:436:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Try removing them and reinstalling
npm cache clean
npm uninstall -g cordova ionic
npm install -g cordova ionic
Use sudo if you are on a mac or a linux.
are you sure you're in the project directory? As in assuming you created your app on the desktop, are you sure you're not in C://Users/username/Desktop instead of C://Users/username/Desktop/myApp ?

bcrypt error after upgrading nodejs gear to v0.12 on Openshift

After upgrading the nodejs version running on my Openshift's gear from v0.10 to v0.12, I get the following error:
Error: /app-root/runtime/repo/node_modules/bcrypt/build/Release/bcrypt_lib.node: undefined
symbol: node_module_register
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/app-root/runtime/repo/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/app-root/runtime/repo/node_modules/bcrypt/bcrypt.js:3:35)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
The bcrypt version in my package.json is set to ~0.8.5.
So far I have tried these without success:
- rhc ssh myapp then update node-gyp, rm -rf node_modules and npm install;
- manually installed the dependencies;
- edited package.json to preinstall node-gyp
"scripts":{
"preinstall": "npm i -g node-gyp && node-gyp clean"
}
anyone has an idea / knows on how I can solve this? (ideally the solution won't require to upgrade gcc)
Also, I am using Ryan J's custom cartridge for nodejs v.012
I finally solved it with a workaround by editing .openshift\lib\utils and adding export OPENSHIFT_NODEJS_VERSION=0.6 in the setup_path_for_custom_node_version() function:
# Add the node binary path to the PATH.
export OPENSHIFT_NODEJS_VERSION=0.6
export PATH="$node_bin_path:${PATH}"

node.js returns "Cannot find module 'lockit-mongodb-adapter'"

I am going through my first node.js project. I've installed lockit , have a app.js file, and when I try to run it I get this error
module.js:340
throw err;
^ Error: Cannot find module 'lockit-mongodb-adapter'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at new module.exports (C:\Users\xx\Documents\mailer\index.js:38:44)
at Object.<anonymous> (C:\Users\xx\Documents\mailer\examples\mongodb\app. js:32:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I am quite certain I have lockit-mongodb-adapter installed.
You need to install the module. Cd to the root of your app directory and run this command and make sure lockit-mongodb-adapter is in your node modules directory.
npm install lockit-mongodb-adapter
Another thing you can do if you are certain it is installed is double check to see what is installed by running this command:
npm list
And this one to see what is installed globally:
npm list -g
Update:
I was able to reproduce the issue you where having. And to resolve it I deleted the module from the node moules directory. And re-installed with the following command:
npm install lockit-mongodb-adapter -save
It now shows up in npm list with no issues:

SailsJS and Forever doesn't work with CoffeeScript

I have a SailsJS app, with much of it written in CoffeeScript.
When running it in Prod mode using "sails lift" all is good.
Running it with forever doesn't work. If I examine the logs, the problem seems to be with node running app.js
/var/www/obelix/api/models/Catalogue.coffee:2
attributes:
^
SyntaxError: Unexpected token :
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /var/www/obelix/node_modules/sails/node_modules/include-all/index.js:96:53
at Array.forEach (native)
at requireAll (/var/www/obelix/node_modules/sails/node_modules/include->all/index.js:40:9)
at buildDictionary >(/var/www/obelix/node_modules/sails/lib/moduleloader/index.js:60:36)
Is it possible to get a sails+coffeescript app to run using node/forever?
The problem is that coffee-script support doesn't work unless you're using sails lift.
Try requiring coffee-script in your app.js file:
// Start sails and pass it command line arguments
require('coffee-script');
require('sails').lift(require('optimist').argv);
Then npm install coffee-script --save

Resources