, the core module is loaded first.
For example, if you want to load and use the http core module, you can do this:
var http = require('http');
This will return an http module object that contains the htpp module APIs defined in the Node API document.
Load file module
You can also use absolute paths to load modules from the file system:
var myModule = require('/home/pedro/my_modules/my_module');
You
looks for the node_modules sub-directory in the current path. If no package is found, the package in this directory is found. the directory specified by the main parameter in the JSON file is then the node_modules sub-directory of the parent directory. The root directory is always found and cannot be found. Find the directory set in node_path.
The second case: the require parameter is the module name in the relative or absolute path, such as require ('. /test.
Install node. js under Ubuntusudo Install Make sudo add-apt-repository ppa:chris-lea/node. jssudo apt-get updatesudo Install NodejsInstalling node. js on CubieboardMy Cubieboard 2 installed is Linaro 12.11, using Ubuntu installation method does not correctly install
Thanks to the contributions of a large number of developers, the Node version has a fast iteration speed and many versions (from 0.6 to 0.11). Therefore, upgrading the Node version has become a problem. At present, there are n and nvm tools that can be used for painless Node upgrade. This article briefly introduces the use of the two tools. Today's topic includes
First, block module multiplexingDefine blocks that need to be reused with blockBlock followed by the name of the module, referenced once the block content will be reused oncePost-compilation results:II, inheritance template (extends)In the actual development, the site's head, the tail is generally common, we can through the Jade template inheritance (extends) function, the public part of the abstraction, and then let the different pages inherit these public parts, and inherited it can also be re
Linux uses node. js to establish a service instance that accesses static Web pagesFirst, install the environment that node. js needs to run.Second, create the node directory (/NODE/WWW) and create the
cake is to execute a script named Cakefile, and Cakefile script is written in Coffeescript. This script only provides a very limited set of built-in functions, such as task, to declare an instruction and its corresponding description and execution function. The other thing is to write a purely node project that compiles either a string compiled using the FS module of node or the output of the coffee module
environment variable. If you want to continue using the node command after restart, you need to set the environment variable:
Run sudo gedit/etc/profile to open the configuration file. Add the following two lines at the end of the file:
Export PATH = "$ HOME/local/node/bin: $ PATH"Export NODE_PATH = "$ HOME/local/
, Query String)7. Learn about NPM and express8. jexpress example, simple page9. Template Engine Jade10, jade implementation of MongoDB home page effect11. Understanding Non-relational database MongoDB12. MongoDB Exploration, characteristics13, MongoDB basis of the increase and deletion14, the basis of MongoDB query15, MongoDB basis of the query 216. MongoDB IndexPart two, node.
.
Step 4: Develop the path and execute the compilation
$ Mkdir ~ /Local: Create a folder in the home directory of the current user
$ Go to the decompressed configure folder and execute./configure -- prefix = $ HOME/local/node to set the compiling path.
$ Make compilation.
$ Sudo make install.
$ Echo 'export PATH = $
Install the upstream version of node. js on Ubuntu Chszs, all rights reserved, without permission, not reproduced. Blogger Home: Http://blog.csdn.net/chszsnode. JS is a software platform that you can use to quickly develop and build scalable Web applications. node.
install curl
After installing curl, you must install all the packages required by Node. js. There are multiple methods to install Node. js. The simplest method is to execute:
# sudo apt-get install Nodejs
However, the latest Node. js
version that can be installed NVM Install XXX version //install XXX version of NODE.JSNVM ls//view already installed node. JS version nvm use XXX version//using the XXX version of node. jsNVM alias default XXX version //Make sure that there is a defaults version3. Development3.1. A simple node.
Start Node. js development in Ubuntu
Node. js learning has been put down for almost two months, and the world has changed so fast that many things have changed and express has been upgraded to 4. x, the change is not small!
My original learning process was to install Ubuntu.12.04 amd64 in VirtualBox. I tried my best to
V. Introduction to Node. js
Node. js is a platform based on Google's V8 engine. It uses the V8 engine and complies with the COMMONJS standard to implement an efficient and stable platform. Node. javascript web programming is based on data streams and can directly manipulate
follows:
D: \ blog> node appExpress server listening on port 3000
When the browser is opened, the following response is returned:
Here we use express (a popular nodeJSweb development framework) and the ejs template engine.
File structure
The directory structure of the initialization file is as follows:
App. js is the entry file
Package. json is a module dependent file. When we use npm install, it downlo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.