ติดตั้ง Node.js, npm, and Angular on CentOS 7.x

AngularJS คืออะไร ?

Angular คือ client-side MVC/MVVM Framework ด้วย JavaScript เหมาะสำหรับเว็บแนว Single Page Applications (SPA) พัฒนาโดย Google

เนื่องจากกำลังลองเล่นอยู่หากเจอ อะไรเพิ่มจะมาเพิ่มเติมใหม่

จากนั้น run คำสั่ง ดังต่อไปนี้เพื่อ ติดตั้ง แต่หาก ยังไม่ได้ yum update ให้ทำก่อน

yum -y install epel-release

yum -y install gcc c++ make

 

ทำการติดตั้ง node js 9.x โดยต้อง update ก่อน (จากที่ลอง ไม่แน่ใจว่าทำไมถึงใช้ node js จากคำสั่ง yum ไม่ได้ แต่เจอปัญหาว่า run ng ไม่ได้)

curl -sL https://rpm.nodesource.com/setup_9.x | sudo -E bash –

จากนั้นติดตั้ง nodejs

yum -y install nodejs

ติดตั้ง angular

npm install -g @angular/cli

อะไรคือ Angular CLI

Angular CLI เป็นเครื่องมือแบบ command line interface ช่วยให้เราเขียน Angular ได้ง่ายและรวดเร็วขึ้น และเป็นตัวช่วยในดำเนินการ Testing, Build โปรเจค และการ Deployment

จากนั้นสร้าง project

ng new <project-name>

ต่อไปเป็นการ run project ที่เราสร้างขึ้น

cd <project-name>

ng serve –host 0.0.0.0 –port 80

0.0.0.0 = ทำให้เข้าได้ ทุก ip

post = port ที่เปิด

หรือ  ng serve radius_uih –host 0.0.0.0 –port 80

จากนั้นอาจจะต้อง build ไป ใส่ web service เอง วิธี มี 

ติดตั้งและคอนฟิก nginx บน CentOS 7 และ build angular ขึ้น nginx

ส่วน apache httpd ยังไม่ได้ลอง


แก้ template http://assist.next-item.com/ ให้ใช้งานได้ บน
Your global Angular CLI version (6.2.4) is greater than your local
version (1.5.0). The local Angular CLI version is used.

คำสั่ง
npm install -g @angular/cli
npm install
npm i -D @angular-devkit/core

แก้ไฟล์
package.json ที่
“devDependencies”: {
“@angular/cli”: “^1.5.0”,
“@angular/compiler-cli”: “5.2.11”,
จากนั้นคำสั่ง
ng serve –host 0.0.0.0 –port 80

สร้างcomponent
ng g component components/login

หากเจอ
Error: dryRunSink.commit(…).ignoreElements is not a function
dryRunSink.commit(…).ignoreElements is not a function
แก้
npm i @angular-devkit/schematics@0.0.45 @angular/cli –no-save

ใส่ความเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องที่ต้องการถูกทำเครื่องหมาย *