Search This Blog

Showing posts with label node. Show all posts
Showing posts with label node. Show all posts

Tuesday, September 20, 2022

React Native TypeError: cli.init is not a function Error !

1. Dont use react-native init <ProjectName>


use like below.

npx react-native init YourProjectName --version 0.68.2



Thursday, August 8, 2019

AngularJS setup in Linux

1. Remove the older NPM / NODE / NG modules
    sudo apt purge ng-common ng-latin
    sudo apt purge node
    sudo apt purge npm
    sudo apt-get update

2. Install new version
     curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - sudo 
OR
     curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash
      apt-get install -y nodejs
OR
     sudo apt-get update  
     apt-cache policy nodejs  
     sudo apt install nodejs
     sudo npm install -g @angular/cli

   npm --version
   node --version

3. Go to your folder
    npm install

4. type
    ng serve --host=ip

 OR to run in background
    nohup ng serve --host=ip &


RUN = http://ip:4200

Monday, September 17, 2018

NodeJS - Request Plugin for file attachment MULTIPART/FORM-DATA

package.json

{
  "name": "sample",
  "version": "1.0.0",
  "description": "",
  "main": "apicall.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": { 
    "request": "^2.83.0" 
  }
}



apicall.js

var fs = require("fs");
var request = require("request");

var fs = require('fs');
var request = require('request');
request.post({
    url: 'https://url/upload',
    formData: {
keyName1: 'value1',
                keyName2: 'value2',               
               file: fs.createReadStream('d:/temp/30off.jpg')
    },
}, function(error, response, body) {
    console.log(body);
});


steps

npm install
node apicall.js

Hit Counter


View My Stats