Can't update dependency library when code was changed in npm - node.js

I just started project react native. I created react native module by command npm install react-native-my-library --save, then run npm install I see it exist in node_module folder.
But when I change code in react native module, and remove folder node_module and run npm install again to update in node_module, it also doesn't update new code that I changed in native module.
Any body can help me to update code in node module folder.
Thanks so much!

Related

Node is not getting installed and it is showing error

I was installing node by using the command on cmd npm install and I got following message
enter image description here
Please help me that how I can solve this issue.
npm stands for node package manager which is used to install external packages or npm modules or libraries hosted on NPM. To get started with a Node JS Project you will need index.js and hit npm init, this will initialise your Node JS Project with auto genreated package.json.
Majorly Node JS, React JS or Angular contains following files:
index.js/server.js(Entry File)
package.json (modules/packages/libraries used in project and script can be written to run your project in different envs)
node_modules (which is auto generated and contains all installed modules listed in package.json)
According to your error message you don't have a package.json file so you need to initialize npm before installing node in your directory.
Initialize it with npm init.
Npm documentation
Step 1- First install Node from https://nodejs.org/en/download/.
Step 2- Now go to your project file cd project.
Step 3- Type the command npm init in console.
Step 5- Now you can see package.json file in your project.
Finish- Now you can install any package by using "npm install packageName" command.

Include BItcoinJS library in electron project

I was wondering how to include the Bitcoin JS Library in my electron project. I tried running npm install inside the project directory and creating a var to use it but it does not work for some reason.
Do you have a package.json in your project directory? If so, does it have Bitcoin JS inside the dependencies:? If not, run npm init and fill out the fields that it asks for or just hit enter several time to leave them blank. After that you should have a package.json file. Now run npm install bitcoinjs-lib --save. You should now have BitcoinJS in your node_modules folder and it should be included as a dependency in your package.json.

Using NodeJS plugins in Electron

I am new to Electron (Atom-shell), and I am trying to load a NodeJS plugin into the application I am building, but I don't know how. The documentation is not clear on that.
For instance, I am trying to use sqlite3 plugin in my app, I used npm install sqlite3, and it was successfully installed. But the application throws and error when I try to call it var sqlite = require('sqlite3'). Are there any further steps I am not aware of ?
Thanks.
For pure JS (i.e. not native) modules you need the following:
Have the module listed in your package.json dependencies
Let electron know where to find the module (e.g. export NODE_PATH=/PATH/TO/node_module)
The first requirement is obvious and the second has its roots in this issue.
For native node modules (such as sqlite3) which use C++ bindings, you need to build them against electron headers to work. According to electron docs, the easiest way to do that would be:
npm install --save-dev electron-rebuild
# Every time you run npm install, run this
./node_modules/.bin/electron-rebuild
To install the npm modules correctly you should go into the folder of your electron app and install the module via npm.
npm install --save sqlite3
The flag --save is important, because npm will install the module inside your app.
Afterwards the require should work.

Why after "npm install express" there is no package.json in my directory?

I am using latest version of nodejs, 0.10.24
I followed this tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/how-to-scrape-web-pages-with-node-js-and-jquery/
after installing npm install express, I can't find the package.json file in the same directory.
But when I tried this on Windows a few months before, I noticed that there was a file in the same directory.
Is there anything I need to do to fix?
Thanks,
When you npm install module ,the only goal is to download and save the module in ./node_module/ directory.
If you want get a package.json, you must use npm init and fill all the information asked.
After that, you can make npm install module --save, that command will download and add the module in your package.json.

cannot run a node.js example

I am trying to run a pre developed example in node.js environment. But i keep on getting the following error:
Cannot find module '/build/default/validation'
Am I missing some module installation from npm here...? I have installed all the other modules like socket-io, websocket, websocket-server, websocket-clien, etc.
-Parag
Check the package.json file for all required modules. Run npm install and npm update to automatically install all required modules and update them.
Usually, npm modules are in a folder *node_modules*, so /build/default/... looks like some custom module that should be shipped with the example.

Resources