Go to directory of your project
mkdir TestProject cd TestProject
Make this directory a root of your project (this will create a default package.json
file)
npm init --yes
Install required npm module and save it as a project dependency (it will appear in package.json
)
npm install request --save
Create a test.js
file in project directory with code from package example
var request = require('request'); request('http://www.google.com', function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body); // Print the google web page. } });
Your project directory should look like this
TestProject/ - node_modules/ - package.json - test.js
Now just run node inside your project directory
node test.js
Related Posts:
- CentOS error – sudo: effective uid is not 0, is sudo installed setuid root?
- How can I update NodeJS and NPM to the next versions?
- sudo: npm: command not found
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- curl: (6) Could not resolve host: google.com; Name or service not known
- npm update broke npm
- Gedit command not working in kali linux terminal
- Chmod 777 to a folder and all contents [duplicate]
- How can I update npm itself?
- npm check and update package if needed
- Amazon Linux: apt-get: command not found
- How do I find all files containing specific text on Linux?
- Where can I find php.ini?
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to install grub after installing Windows 10
- Linux: ‘Username’ is not in the sudoers file. This incident will be reported
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- Node.js – SyntaxError: Unexpected token import
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- nodemon not found in npm
- QEMU: /bin/sh: can’t access tty; job control turned off
- Explaining the ‘find -mtime’ command
- Meaning of exit status 1 returned by linux command
- npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- Why am I getting “Error socket hang up” response?
- Node.js Port 3000 already in use but it actually isn’t?
- Creating a new directory in C
- Extract file basename without path and extension in bash
- mv: cannot stat error : No such file or directory error
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- Pseudo-terminal will not be allocated because stdin is not a terminal
- linux command to get size of files and directories present in a particular folder?
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- ./configure : /bin/sh^M : bad interpreter
- TCP congestion control version: HTCP module vs highspeed module in linux kernel
- How to use regex with find command?
- How to install npm peer dependencies automatically?
- How to Reinstall Broken npm
- What is the difference between /etc/rc.local and ~/.bashrc?
- Snort Message – WARNING: No preprocessors configured for policy 0
- Compile the Fortran program in Windows using gfortran
- Yum fails with – There are no enabled repos.
- Cannot npm install due to node-gyp: binding.gyp not found
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- Downgrade npm to an older version
- How do I fix the npm UNMET PEER DEPENDENCY warning?
- npm install resulting in ‘ENOENT: no such file or directory’
- Using ls to list directories and their total sizes
- configure: error: cannot run C compiled programs
- What does set -e mean in a bash script?
- Npm Error – Windows NT – How to resolve
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- NPM install fails with node-gyp
- How to properly upgrade node using nvm
- npm update check failed
- Pipe to/from the clipboard in a Bash script
- Difference between exec, execvp, execl, execv?
- what does -zxvf mean in tar -zxvf filename?
- Retrieve last 100 lines logs
- Configuring Apache for localhost
- Restarting cron after changing crontab file?
- cd into directory without having permission
- npm init not working and getting stuck on version
- GYP ERR! build error. stack Error: ‘make’ failed with exit code 2
- What does ‘bash -c’ do?
- How do I know the script file name in a Bash script?
- WordPress can’t find temporary folder, but folder it’s looking at has correct permissions
- WordPress cloning issue
- How to run a server on port 80 as a normal user on Linux?
- Copying a large directory tree locally? cp or rsync?
- Check if port is open or closed on a Linux server?
- Moving an already-running process to Screen
- When does `cron.daily` run?
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- How to run a command multiple times, using bash shell?
- LVM dangers and caveats
- How to reconnect to a disconnected ssh session
- Should I quit using Ifconfig?
- How to know from which yum repository a package has been installed?
- tar – Remove leading directory components on extraction
- How to list Apache enabled modules?
- How can I monitor hard disk load on Linux?
- What’s the reverse DNS command line utility?
- How to add a security group to a running EC2 Instance?
- How bad is it really to install Linux on one big partition?
- How do I extract login history?
- SSH from A through B to C, using private key on B [closed]
- Is it possible to reboot a Linux OS without rebooting the hardware?
- Does the “bs” option in “dd” really improve the speed?
- What solutions exist to allow the use of revision control for server configuration files? [closed]
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- How to apply a filter to real time output of `tail -f `?
- Practical maximum open file descriptors (ulimit -n) for a high volume system
- Dump a linux process’s memory to file
- How to handle relative urls correctly with a reverse proxy
- What is the difference between /sbin/nologin and /bin/false?
- Where’s the conventional place to store git repositories in a linux file system tree?