Google cloud platform 每次登录GCP Cloud Shell时都找不到ng命令

Google cloud platform 每次登录GCP Cloud Shell时都找不到ng命令,google-cloud-platform,angular-cli,google-cloud-shell,Google Cloud Platform,Angular Cli,Google Cloud Shell,我注意到每次登录Google Cloud Shell时,我的“ng”命令都无法识别 weilies@cloudshell:~/dev (cloud-xp)$ cd sunny-app/ weilies@cloudshell:~/dev/sunny-app (cloud-xp)$ ng serve -disable-host-check -bash: ng: command not found 我必须用命令重新安装它们,然后我得到了我的ng命令。 weilies@cloudshell:~(clo

我注意到每次登录Google Cloud Shell时,我的“ng”命令都无法识别

weilies@cloudshell:~/dev (cloud-xp)$ cd sunny-app/
weilies@cloudshell:~/dev/sunny-app (cloud-xp)$ ng serve -disable-host-check
-bash: ng: command not found
我必须用命令重新安装它们,然后我得到了我的ng命令。 weilies@cloudshell:~(cloud xp)$ng--版本

但有一件事我注意到,安装返回错误(但它并没有阻止我运行angular应用程序,所以我干脆忽略了)


每次登录GCP Clould shell时,我都需要安装angular/cli,这真让人恼火。ng不是用-g标志全局安装的吗?

这是因为,当您运行
npm install-g@angular/cli
时,它是全局安装的(在
/usr/local/
目录中)

然而,Cloud Shell有一些功能,其中之一是它是一个“易失性”实例,您在
$HOME
之外对它所做的任何修改都会在会话终止后丢失


Cloud Shell用于快速测试或管理命令。您可能更愿意使用计算引擎实例(可以有1个)来满足开发需求。

这是因为,当您运行
npm install-g@angular/cli
时,它是全局安装的(在
/usr/local/
目录中)

然而,Cloud Shell有一些功能,其中之一是它是一个“易失性”实例,您在
$HOME
之外对它所做的任何修改都会在会话终止后丢失


Cloud Shell用于快速测试或管理命令。您可能更愿意使用一个计算引擎实例(您可以有1个)来满足开发需求。

云Shell虚拟机是短暂的,并且在每个会话结束时被丢弃(但是,您的云Shell主目录是持久的)。但是,可以添加脚本以在启动时自定义云Shell环境。请遵循。

云Shell虚拟机是短暂的,在每个会话结束时都会被丢弃(但是,您的云Shell主目录是持久的)。但是,可以添加脚本以在启动时自定义云Shell环境。请遵循。

我已申请免费实例。我之所以需要“ng”是因为我要在GCP中做一些“严肃”的发展。我需要酷编辑器功能,这在实例中不可用。所以我想我必须接受它。只要在每次我访问cloud shelli时重新安装,我就可以获得免费的实例。我之所以需要“ng”是因为我要在GCP中做一些“严肃”的发展。我需要酷编辑器功能,这在实例中不可用。所以我想我必须接受它。每次我访问cloud shell时只需重新安装
     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.1.7
Node: 10.14.2
OS: linux x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.901.7
@angular-devkit/core         9.1.7
@angular-devkit/schematics   9.1.7
@schematics/angular          9.1.7
@schematics/update           0.901.7
rxjs                         6.5.4
weilies@cloudshell:~ (cloud-xp)$ npm install -g @angular/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/local/nvm/versions/node/v10.14.2/bin/ng -> /usr/local/nvm/versions/node/v10.14.2/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@9.1.7 postinstall /usr/local/nvm/versions/node/v10.14.2/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

+ @angular/cli@9.1.7
added 271 packages from 206 contributors in 15.296s