2017-12-19 3 views
1

전 세계적으로 이미 @ angular/cli @ 1.4.5를 설치했습니다. Angular 5 앱을 만들기 위해 @ angular/cli @ latest를 로컬로 설치하는 방법이 있습니까?Angular 4 app 및 Angular 5 app을 같은 머신에 작성하는 방법은 무엇입니까?

$ ng -v 
    _      _     ____ _  ___ 
/\ _ __ __ _ _ _| | __ _ _ __ /___| | |_ _| 
/△ \ | '_ \/_` | | | | |/ _` | '__| | | | | | | 
/___ \| | | | (_| | |_| | | (_| | |  | |___| |___ | | 
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_|  \____|_____|___| 
       |___/ 
@angular/cli: 1.4.5 
node: 6.11.2 
os: win32 x64 
@angular/animations: 4.3.6 
@angular/cdk: 2.0.0-beta.10 
@angular/common: 4.3.6 
@angular/compiler: 4.3.6 
@angular/core: 4.3.6 
@angular/forms: 4.3.6 
@angular/http: 4.3.6 
@angular/material: 2.0.0-beta.10 
@angular/platform-browser: 4.3.6 
@angular/platform-browser-dynamic: 4.3.6 
@angular/router: 4.3.6 
@angular/cli: 1.4.5 
@angular/compiler-cli: 4.3.6 
@angular/language-service: 4.3.6 
typescript: 2.3.4 
+0

같은 문제가 있습니다. 동일한 Mac에서 Ang4 및 Ang5 프로젝트를 빌드/유지해야하지만 AngularCLI 버전 제어 이상을 의미한다고 생각됩니다. "save dev"와 함께 설치해야하는 패키지가 여러 개 있습니다. 대 "글로벌". 따라서 답변 작성자는 완전한 블로그 게시물이나 기사 참조와 같은 완벽한 솔루션을 제시하십시오. – user292701

답변

1

가장 간단한 방법은 아마 npx을 사용하는 것입니다 : 당신이 비교적 새로운 버전을 사용하는 경우

npx @angular/[email protected] new <project> 

npx 이미 npm와 다른 노드 바이너리에 포함되어야한다.

또한 로컬이 CLI를 설치하고 새 프로젝트 생성이 로컬 설치를 사용할 수 있습니다.

cd <helper> 
npm init 
npm install --save-dev @angular/[email protected] 
cd .. 
<helper>/node_modules/.bin/ng new <project> 

그것은 조금 바보입니다,하지만 당신은 이미 디렉토리에 ng new을 사용할 수 없습니다 위의 내용은 큰 문제없이 작동해야하지만 npx 경로는 훨씬 간단해야합니다.