Jenkins + Nodejs compiling packaged Nodejs application

Source: Internet
Author: User

Nodejs's image URL: https://npm.taobao.org/mirrors/node/latest-v6.x/

First, install the Nodejs

Download nodes, and install:

# cd /app/service_tools/# wget https://npm.taobao.org/mirrors/node/v9.3.0/node-v9.3.0-linux-x64.tar.xz# xz -d node-v9.3.0-linux-x64.tar.xz# tar xf node-v9.3.0-linux-x64.tar# ln -s /app/service_tools/node-v9.3.0-linux-x64 /app/service_tools/node-v9.3.0# ln -s /app/service_tools/node-v9.3.0/bin/node /usr/bin/node# ln -s /app/service_tools/node-v9.3.0/bin/npm /usr/bin/npm如果可以查看到版本号证明安装成功:[[email protected] ~]# node -vv9.3.0[[email protected] ~]# npm -v5.5.1

Sometimes an error occurs when compiling a front-end project via NPM:

npm ERR! path /app/Jenkins/.jenkins/workspace/test-marketweb-second/package.jsonnpm ERR! code ENOENTnpm ERR! errno -2npm ERR! syscall opennpm ERR! enoent ENOENT: no such file or directory, open ‘/app/Jenkins/.jenkins/workspace/test-marketweb-second/package.json‘npm ERR! enoent This is related to npm not being able to find a file.npm ERR! enoent npm ERR! A complete log of this run can be found in:npm ERR!     /root/.npm/_logs/2018-06-12T09_51_48_611Z-debug.logBuild step ‘Execute shell‘ marked build as failureSSH: Current build result is [FAILURE], not going to run.Finished: FAILURE

When you encounter this problem, you can try to install the CNPM command and Webpack:

# npm install -g cnpm --registry=https://registry.npm.taobao.org# ln -s /app/service_tools/node-v9.3.0/bin/cnpm /usr/bin/cnpm# cnpm install webpack -g

Jenkins configuration:
In System Management, Global Tool Configuration, set the installation method for Nodejs, or install the path:

First, new project selection "Building a free-style software project"

Second, the project configuration
Setting up the environment for the node environment in the build environment

Build command:

Jenkins + Nodejs compiling packaged Nodejs application

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.