Otu esi etinye Gulp.js na Rocky Linux 8

Gburugburu bụ ihe n'efu, ngwa Javascript mepere emepe nke na-enyere ndị mmepe aka imeziwanye usoro ọrụ. Gulp bụ ọrụ na-arụ na Node.js na NPM nke na-enyere ndị mmepe aka ibelata ọtụtụ ọrụ na-ewe oge dị ka mgbanwe na njikarịcha, n'etiti ọtụtụ ihe ndị ọzọ. Gulp na-egosipụtakwa mmepụta ọkpọkọ site n'otu ọrụ dị ka ntinye n'ime nke na-esote.

N'ime nkuzi a, ị ga-amụta Otu esi etinye Gulp.js na Rocky Linux 8.

Prerequisites

  • OS akwadoro: Rocky Linux 8.+.
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.
  • Ngwungwu achọrọ: curl, ọnụ na npm

Melite Sistemụ Ọrụ

Melite gi Nkume linux Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo dnf upgrade --refresh -y

Nkuzi a ga-eji ya sudo iwu na na-eche na ị nwere ọnọdụ sudo. Iji nyochaa ọkwa sudo na akaụntụ gị:

sudo whoami

Ihe atụ na-egosi ọkwa sudo:

[joshua@rockylinux ~]$ sudo whoami
root

Ka ịtọlite ​​akaụntụ sudo dị adị ma ọ bụ ọhụrụ, gaa na nkuzi anyị na Otu esi etinye onye ọrụ na Sudoers na Rocky Linux.

Iji mgbọrọgwụ akaụntụ, jiri iwu na-esonụ na paswọọdụ mgbọrọgwụ banye.

su

Lelee ma ọ bụ Wụnye ngwugwu Curl

curl achọrọ maka akụkụ ụfọdụ nke ntuziaka a. Iji wụnye ngwugwu a, pịnye iwu a:

sudo dnf install curl -y

Advertisement


Wụnye Node.js

Iji wụnye nke ọma na, nke ka mkpa, jiri Gulp.js, ịkwesịrị ịwụnye Node.js. Usoro a dịtụ mfe.

Mbụ, ị ga-achọ ibubata Node.js (ụdị kacha ọhụrụ 16) isi iyi na iwu iwu dị ka ndị a:

sudo curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -

Rịba ama, enwere ike ịhụ nsụgharị ọzọ na Ibe mwepụta ọnụ ụzọ.

Na-esote, pịnye iwu na-esonụ ka ịwụnye Node.js ngwugwu:

sudo dnf install nodejs

Ihe atụ mmepụta:

Otu esi etinye Gulp.js na Rocky Linux 8

ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na nwụnye.

N'oge echichi, a ga-akpali gị ibubata ihe igodo GPG:

Otu esi etinye Gulp.js na Rocky Linux 8

Ịkwesịrị ịnakwere nke a, ma ọ bụ nrụnye ga-ada; Ụdị Y, wee pịa Tinye igodo iji kwado na mezue nrụnye.

Iji kwenye Node.js etinyere ya nke ọma yana iji hụ na nrụpụta na ụdị, jiri ihe ndị a:

node -v

Ihe atụ mmepụta:

v.16.8.0

Mgbe ị wụnyere Node.js, ọ na-akpaghị aka arụnyere NPM nakwa. Iji nyochaa ụdị ma wuo ya, ị nwekwara ike iji iwu a:

npm -v

Ihe atụ mmepụta:

7.21.0

Wụnye Gulp.js na Rocky Linux 8

Wụnye Gulp CLI

Nzọụkwụ mbụ bụ ịwụnye Ọnụ ego CLI Ngwá ọrụ zuru ụwa ọnụ na sistemụ Rocky Linux gị, nke a na-eji na-arụ ọrụ yana jikwaa ngwa Gulp.js gị.

Iji wụnye ngwa Gulp CLI, mebie iwu a:

npm install -g gulp-cli

Ozugbo arụnyere, gaa n'ihu na ịwụnye Gulp.js.

Wụnye Gulp.js

Iji wụnye Gulp.js, ị ga-ebu ụzọ mepụta ndekọ eji dị ka akwụkwọ ndekọ aha ngwa gị.

Jiri iwu a dịka ọmụmaatụ:

sudo mkdir gulp-directory && cd gulp-directory

Ugbu a ị mepụtara ndekọ ahụ wee gaa na ya, mepụta ngwa ọhụrụ site na iji iwu npm na-esonụ:

sudo npm init

Na-esote, ị ga-ahụ usoro ajụjụ iji nye ozi na ngwa ọhụrụ gị, dịka egosiri n'okpuru:

package name: (gulp-directory) 
version: (1.0.0) 
description: Gulp Application
entry point: (index.js) 
test command: echo "My app" $$ exit 1
git repository: 
keywords: gulp
author: Joshua James
license: (ISC) 
About to write to /home/joshua/gulp-directory/package.json:

{
  "name": "gulp-directory",
  "version": "1.0.0",
  "description": "Gulp Application",
  "main": "index.js",
  "scripts": {
    "test": "echo \"My app\" $$ exit 1"
  },
  "keywords": [
    "gulp"
  ],
  "author": "Joshua James",
  "license": "ISC"
}


Is this OK? (yes) yes

Ozugbo emechara, wụnye ya modul gulp na ngwa gị nwere iwu njedebe a:

sudo npm install --save-dev gulp

Iji gosi na arụnyere Gulp.js nke ọma yana iji hụ na arụrụ ya na ụdị ya, jiri ihe ndị a:

gulp --version

Ihe atụ mmepụta:

CLI version: 2.3.0
Local version: 4.0.2

Advertisement


Mepụta ngwa ule (Ndewo ihe atụ ụwa)

Ugbu a ị tinyela Gulp.js nke ọma na ndekọ ngwa gị, ị ga-emepụta ihe atụ ngwa ngwa ka ị mara ka esi eji Gulp.js site na ịmepụta ama ama. Ndewo Ụwa ngwa ngwa ihe atụ.

Mbụ, gaa na ndekọ gị na mepụta faịlụ gulpfile.js:

cd gulp-direct && sudo nano gulpfile.js

ugbu a idetuo na mado koodu a:

var gulp = require('gulp');

gulp.task('hello', function(done) {
  console.log('Hello World!!!');
  done();
});

Chekwaa faịlụ (Ctrl+O), wee pụọ (CTRL+X).

Na-esote, rụọ ọrụ Gulp site na ime iwu a:

gulp hello

Ihe atụ mmepụta:

[22:49:40] Using gulpfile /home/joshua/gulp-directory/gulpfile.js
[22:49:40] Starting 'hello'...
Hello World!!!
[22:49:40] Finished 'hello' after 1.21 ms

Okwu na mmechi

Ị mụtala ka esi etinye Gulp.js na sistemụ Rocky Linux 8 gị wee mee ngwa nyocha ngwa ngwa na nkuzi. Gulp dị egwu dịka ọ na-ahapụ onye ọrụ ka ọ rụọ ọrụ ma rụọ ọrụ ugboro ugboro n'ụzọ dị mfe yana ọ na-ewu ewu nke ukwuu n'etiti ọtụtụ ndị mmepe.

Maka ozi ndị ọzọ, gaa na onye ọrụ gọọmentị ibe akwukwo maka ịmụtakwu ihe.

Idenye aha
Gwa nke
0 Comments
Inline nzaghachi
Lee echiche niile
0
Ga-ahụ n'anya gị echiche, biko okwu.x