Search code examples
node.jsbashshellgoogle-app-enginedeveloper-console

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


I created new project in https://console.developers.google.com . Cloned one project from git, then issued command:

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

and

gcloud init

after doing this I'm no longer able to call

npm install

command, because cloud shell throws error

bash: npm: command not found

how can I revert (repair) Cloud shell to its primary state.

I even can't make Node.js example projects...


also

 node -v

returns

 bash: node: command not found

Solution

  • I reinstalled node.

    At first I removed this dir:

     rm -rf /usr/local/lib/node_modules
    

    then used these commands, since VM OS is Linux:

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

    finally:

     sudo apt-get install -y build-essential
    

    instructions are taken from

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


    now echo PATH="$PATH" outputs:

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

    after all I decided to delete my google account and start everything from scratch, that is I created new account which had poperly working developer console.