Burchakli CLI yordamida burchakli 4-burilishli loyihani yarating

Quyidagi buyrug'i bilan burchakli CLI yordamida eng yangi burchakli 4-versiyada yangi loyihani qanday yarataman:

yangi new_project qo'shing

O'rnatilgan quyidagi versiyalar mavjud

 - @angular/cli: 1.0.0-rc.2
 - node: 7.7.3
 - npm: 4.4.1
18

10 javoblar

Kutubxona 4 qutisidan foydalanadigan CLI bilan yangi burchakli dasturni yaratib bo'lmaydi. Hech bo'lmasa, hozir emas. Faqat burchakli 2 CLI tomonidan qo'llab-quvvatlanadi. Menimcha, bu tez orada o'zgaradi.

However, you can create a new application using ng new , and then change the version of Angular it uses in the package.json. Run npm install, and it should all work. That has been my experience.

Umid qilamanki, bu sizga yordam beradi.

UPDATE:

Men xato qilyapman! Ng 4 ni ishlatish uchun loyihani o'rnatadigan ng new buyrug'iga o'tishingiz mumkin.

ng new project_new --ng4 ni bosing

ng --help dan:

- ng4 (Boolean) (asl qiymati: noto'g'ri) Shabloni burchak 4 bilan loyiha yarating.

Ayni paytda @angular bo'limiga package.json quyidagi tarzda o'rnatiladi.

  "dependencies": {
    "@angular/common": ">=4.0.0-beta <5.0.0",
    "@angular/compiler": ">=4.0.0-beta <5.0.0",
    "@angular/core": ">=4.0.0-beta <5.0.0",
    "@angular/forms": ">=4.0.0-beta <5.0.0",
    "@angular/http": ">=4.0.0-beta <5.0.0",
    "@angular/platform-browser": ">=4.0.0-beta <5.0.0",
    "@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
    "@angular/router": ">=4.0.0-beta <5.0.0",
    ...

Faqat uni sinab ko'rdim va u ishlaydi.

UPDATE 2

- ng4 tanlovi hozirda so'nggi CLI endi ng new project_name dan foydalangan holda burchakli 5 loyihasini yaratadi.

28
qo'shib qo'ydi
# Angular4 tagida joylashgan va siz "gen" angularcli bilan yangi burchakli ilovani sizlarga # angular4 ilovasini beradi. "Package.json" ni yangilang.
qo'shib qo'ydi muallif Kelvin Muia, manba
"Package.json" faylini yangilashga javob berishga rozilik beraman. Buning angularcli bilan mumkinligini bilish uchun nima kerak.
qo'shib qo'ydi muallif Kelvin Muia, manba
Javobingiz uchun rahmat. Men aslida buni qildim va 4.0 beta verison oldim. Eng so'nggi versiya 4.0.0-rc.3 va sizning javobingiz to'g'ri. Faqat hozirgi CLI uni sukut bo'yicha tanlashi mumkin, deb o'ylayman, ya'ni oxirgi versiya 4.0.0-rc.3
qo'shib qo'ydi muallif Kelvin Muia, manba
Ushbu havolaning to'g'riligi nima ekanini aniqlang. twitter.com/ladyleet/status/841074080342134785
qo'shib qo'ydi muallif Kelvin Muia, manba
Menda qaerdaligini Twitterda to'sib qo'ydi va bu haqda men bundan mamnun emasman. :)
qo'shib qo'ydi muallif R. Richards, manba
Sizga buni ta'kidlaganingizdan xursandman! Javobimni yangiladim.
qo'shib qo'ydi muallif R. Richards, manba
Xo'sh, bu package.json @angular versiyasi uchun oraliqni ishlatadi. Shunday qilib, u eng so'nggi (5-versiya qadar) tortadi. Men ishdan chiqqani v4.0.0-rc.3. Bu siz xohlagan narsani qilmoqda.
qo'shib qo'ydi muallif R. Richards, manba

Buruq CLI yYokidamida burchakli 4 loyihasini yaratish uchun eng oson usuli @ angular/cli ning eski versiyasini o'rnatadi (1.4.10)

npx @angular/[email protected] new myangular4

(rahmat pYokitlash pills )

Yoki

> npm remove -g @angular/cli
> npm install -g @angular/[email protected]
> ng --version
  @angular/cli: 1.4.10
> ng new myangular4

Myangular4/pack.json hosil qiladi

{
  "name": "myangular4",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/cYokie": "^4.2.4",
    "@angular/fYokims": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platfYokim-browser": "^4.2.4",
    "@angular/platfYokim-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "cYokie-js": "^2.4.1",
    "rxjs": "^5.4.2",
    "zone.js": "^0.8.14"
  },
11
qo'shib qo'ydi
npx @ angular/cli @ 1.4.10 new myangular4 ni bajarish ancha oson bo'lishi mumkin.
qo'shib qo'ydi muallif Explosion Pills, manba
Bu yondashuv men uchun ishladi, faqat v1.4.10 versiyasini (npm install -g @ angular/cli @ 1.4.10) ishlatishim kerak edi. Bir do'stim meni bu erda tasvirlangan savolga duch kelganidan keyin 1.4.10 versiyasiga yo'lladi ( github.com/burchak/burchaklar/muammolar/9303 ) va tavsiya etilgan echimni qo'llagan.
qo'shib qo'ydi muallif Eric Bowden, manba
Yaxshi fikr, rahmat, @Explosion Pills
qo'shib qo'ydi muallif rjdkolb, manba
Rahmat @ ErikBowden va Ivan. Men javobimni yangiladim.
qo'shib qo'ydi muallif rjdkolb, manba
Men "ng my-ng-project" ni ishga tushirganimda yuqoridagi sharh bilan bir xil xatolarga duch keldim. Ishlayotgan "npm -G @ angular/cli" va "npm install -g @ angular/cli @ 1.4.10" ni ishga tushirish uchun ishga tushirildi.
qo'shib qo'ydi muallif Ivan Monteiro, manba

Mening vaziyatimda uzoq vaqt oldin (taxminan 4 oy, lekin burchak shaklida juda uzoq vaqt ) o'rnatilgan edi. Agar npm install -g @ angular/cli ni amalga oshirish ishni bajarmasa.

Kliptni yangilash uchun npm install -g @ angular/cli --upgrade ga ega bo'lishim kerak edi.

Then doing ng new myProject --mobile got me the >4 Angular

3
qo'shib qo'ydi
Hozir bu ish kerak. Ushbu savol Angliyaning 4-chi versiyasi amalga oshishidan oldin edi. Rahmat. -
qo'shib qo'ydi muallif Kelvin Muia, manba

Angular CLI yordamida Angular_4 loyihasini yaratish uchun quyidagi buyruqlar qatorlarini bajaring:

    

npm o'chirildi -g @ burchakli/cli

         

npm o'rnatish -g @ angular/cli @ 1.4.10

           
3
qo'shib qo'ydi
Nihoyat, @ angular/cli uchun pastga o'tishni topdik, ko'pgina rahmat @BlackHoLe
qo'shib qo'ydi muallif Ignacio Ara, manba
bu qadamlar 5dan 4gacha burchakka tushirish uchun menga ishlagan
qo'shib qo'ydi muallif Suriya Rakhunathan, manba
@SuriyaRakhunathan Men sizga yordam berishdan xursandman
qo'shib qo'ydi muallif BlaCk HoLe, manba

Burchak-qirq versiyangizni yangilang, keyin yangi burchakli 4 dastur yaratish uchun "new_project" buyrug'idan foydalaning.

3
qo'shib qo'ydi
Hozir bu ish kerak. Ushbu savol Angliyaning 4-chi versiyasi amalga oshishidan oldin edi. Rahmat.
qo'shib qo'ydi muallif Kelvin Muia, manba
burchak cli versiyasini qanday yangilash kerak?
qo'shib qo'ydi muallif Saravanan Nandhan, manba

Yuqoridagi javoblar to'g'ri. Biroq, siz ochiq burchakka ega bo'lgan loyihangiz bo'lsa, VS kodida ayting-chi, siz bir necha turli qadamlarni talab qilishingiz mumkin.

  1. Install Node.js® and npm if they are not already on your machine.
  2. Then install the Angular CLI globally: npm install -g @angular/cli
  3. Inside the VS code terminal run: npm install
  4. (Inside the VS code terminal) serve the application: ng serve --open
2
qo'shib qo'ydi

Siz oxirgi burchakli CLI versiyasini tekshirishingiz kerak:

ng -v

Agar siz versiyani faqat ishga tushirishni/yangilashni talab qilsangiz

sudo npm -g @ angular/cli @ last

-ni tanlang

Keyin comand bilan loyiha yaratishingiz mumkin

yangi Project_Name

Yana bir necha variant bor, faqat FYI

yangi Project_Name --style = scss

Endi "Project_Name" nomli yangi loyiha yaratiladi.

"dependencies": {
  "@angular/animations": "^4.2.4",
  "@angular/common": "^4.2.4",
  "@angular/compiler": "^4.2.4",
  "@angular/core":  "^4.2.4",
  "@angular/forms": "^4.2.4",
  "@angular/http": "^4.2.4",
  "@angular/platform-browser": "^4.2.4",
  "@angular/platform-browser-dynamic": "^4.2.4",
  "@angular/router": "^4.2.4"
}

Buyruq bo'yicha yangilashingiz mumkin bo'lgan paketlarni yangilashni xohlasangiz

npm install @angular/{{pack_name}}//masalan. npm o'rnatish @ burchak/yadro

1
qo'shib qo'ydi

Step 1. Set up the Development Environment: Install Node.js and npm if they are not installed.

Step 2: Then install the Angular CLI globally.

npm -g @ angular/cli @ 1.4-ni tanlang.

Step 3: Create a new project

Mening yangi ilovam

Step 4: run the application:

mening cd my-app -ga teging

xizmat qilishni boshlagan

Yuqoridagi ilova 4 burchak ostida bo'ladi.

0
qo'shib qo'ydi

I do it as indicated by the official documentation of Angular

npm install -g @angular/cli
ng new your-app
cd your-app
ng serve --open

open your browser on http://localhost:4200/

0
qo'shib qo'ydi
Oh burchakli 3 ta ilova ... :(
qo'shib qo'ydi muallif catbadger, manba
rasmiy hujjatlardan foydalaning angular.io/guide/quickstart @catbadger
qo'shib qo'ydi muallif shades3002, manba
  1. In my case i updated the package.json i set the version of all the packages begin with @angular to 4.x.x except angular/cli ( i.e : @angular/animations": "4.x.x") which means import the latest version of the version 4 (which is 4.4.6).

  2. then i executed npm install.

  3. to verify the installed version execute : npm list --depth=0 | grep angular

  4. this is a part of the updated package.json :

    "dependencies": { "@angular/animations": "4.x.x", "@angular/common": "4.x.x", "@angular/compiler": "4.x.x", "@angular/core": "4.x.x", "@angular/forms": "4.x.x", "@angular/http": "4.x.x", "@angular/platform-browser": "4.x.x", "@angular/platform-browser-dynamic": "4.x.x", "@angular/platform-server": "4.x.x", "@angular/router": "4.x.x", "@ngx-translate/core": "^6.0.1", "@ngx-translate/http-loader": "0.0.3", "@types/form-data": "^2.2.0", "@types/hammerjs": "^2.0.35", "angular2-jwt": "^0.2.2", "angular2-text-mask": "^8.0.3", "base64-js": "^1.2.1", "browser-sync": "^2.23.2", "chart.js": "^2.7.0", "classlist.js": "1.1.20150312", "core-js": "2.4.1", "crypto-js": "3.1.9-1", "expect": "^1.20.2", "font-awesome": "4.7.0", "google-libphonenumber": "3.0.3", "hammerjs": "^2.0.8", "intl": "1.2.5", "lodash": "4.17.4", "moment-timezone": "^0.5.14", "ng2-page-scroll": "4.0.0-beta.7", "pako": "^1.0.6", "pdfjs-dist": "^1.8.398", "rxjs": "^5.4.2", "url-search-params-polyfill": "^2.0.1", "vls-web-modules": "0.0.21", "web-animations-js": "^2.3.1", "zone.js": "0.8.4" }, "devDependencies": { "@angular/cli": "1.6.5", "@angular/compiler-cli": "4.x.x", "@angular/platform-server": "4.x.x", "@angularclass/hmr": "^2.1.3", "@compodoc/compodoc": "^1.0.1", "@types/globalize": "0.0.31", "@types/googlemaps": "^3.30.0", "@types/jasmine": "^2.8.3", "@types/node": "^6.0.88", "@vls-web-modules/zuul-binder": "0.0.11", "codelyzer": "^2.0.1", "enhanced-resolve": "3.3.0", "immutable": "^3.8.1", "jasmine-core": "2.8.0", "jasmine-spec-reporter": "~3.2.0", "karma": "~1.4.1", "karma-chrome-launcher": "~2.0.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "0.2.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "0.2.2", "karma-phantomjs-launcher": "^1.0.4", "protractor": "~5.1.0", "release-it": "2.7.3", "ts-node": "~2.0.0", "tslint": "~4.5.0", "typedoc": "0.6.0", "typescript": "2.4", "webpack-bundle-analyzer": "^2.9.0" }

0
qo'shib qo'ydi
Angular Uzbekistan
Angular Uzbekistan
107 ishtirokchilar

Guruh Angular bo'yicha muloqot qilish uchun ochilgan Sizni qiziqtirsa: @nodejs_uz @react_uz @angular_uz @yiiframework_uz @js_uzb @typescript_uzb @vuejs_uz @ngTashkent @laravel_uz @uzdevgroup Ish o'rinlari @UzDev_jobs

ngTashkent
ngTashkent
77 ishtirokchilar

Правила просты: 1. Не хамить 2. Не хейтить 3. Реакт не нужен Ссылки: https://t.me/angular_ru - старший брат https://t.me/angular_uz - ангулар на узбекском @js_uzb @vuejs_uz @react_uz @nodejs_uz @yiiframework_uz @uzdevgroup @UzDev_Jobs @tasdev_talks