簡體   English   中英

新建 Angular 應用創建

[英]New Angular application creation

在 vs code 的終端中輸入命令 [ng new app_name] 后,它會創建一個包含以下文本的文件

#!/usr/bin/env node
/**
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

/* eslint-disable no-console */
/* eslint-disable import/no-unassigned-import */
'use strict';

// Provide a title to the process in `ps`.
// Due to an obscure Mac bug, do not start this title with any symbol.
try {
  process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');
} catch (_) {
  // If an error happened above, use the most basic title.
  process.title = 'ng';
}

這個文件有點長,所以我從上半部分粘貼了一些行。

我無法弄清楚為什么我無法創建新應用程序。

看起來你的cli沒有正確安裝或損壞。 您可以嘗試以下操作:

ng version

它將顯示有關 Angular CLI、Node 等版本的一些信息。

如果它不起作用,請再次安裝 cli:

npm install -g @angular/cli

關於npx ,您可以在此處閱讀更多內容。

NPX:npx 代表 Node Package Execute,它隨 npm 一起提供,當您在 5.2.0 版本以上安裝 npm 時,npx 將自動安裝。 It is an npm package runner that can execute any package that you want from the npm registry without even installing that package. The npx is useful during a single time use package. If you have installed npm below 5.2.0 then npx is not installed in你的系統。 您可以通過運行以下命令來檢查 npx 是否已安裝:

因此,如果 npx 對您有用,那么使用npx並沒有錯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM