Google云平台。 npm install - (bash) 找不到 npm 命令。如何修复Google云shell

Google Cloud platform. npm install - (bash) npm command not found. How to repair Google cloud shell

我在 https://console.developers.google.com 中创建了新项目。 从 git 克隆了一个项目,然后发出命令:

curl https://sdk.cloud.google.com | bash 

gcloud init

完成此操作后,我无法再拨打

npm install

命令,因为云 shell 抛出错误

bash: npm: command not found

如何将 Cloud shell 恢复(修复)到其主要状态。

我什至无法制作 Node.js 示例项目...


还有

 node -v

returns

 bash: node: command not found

我重新安装了节点。

起初我删除了这个目录:

 rm -rf /usr/local/lib/node_modules

然后使用这些命令,因为 VM OS 是 Linux:

 curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
 sudo apt-get install -y nodejs

最后:

 sudo apt-get install -y build-essential

说明来自

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions


现在 echo PATH="$PATH" 输出:

 PATH=/home/benas/ls/google-cloud-sdk/bin:/google/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

毕竟我决定删除我的 google 帐户并从头开始一切,也就是说,我创建了一个新帐户,该帐户具有正常工作的开发人员控制台。