GoogleCloudPlatform / nodejs-getting-started

A tutorial for creating a complete application using Node.js on Google Cloud Platform
https://cloud.google.com/nodejs
Apache License 2.0
804 stars 382 forks source link

Bookshelf APP: Got errors at npm install #32

Closed zijih closed 8 years ago

zijih commented 8 years ago

my project folder: zijihgo@sanguine-willow-112918:~/6-pubsub Repro steps: The Bookshelf App After: (1) git clone https://github.com/GoogleCloudPlatform/nodejs-getting-started.git -b 6-pubsub 6-pubsub (2) cd 6-pubsub (3)updated config.js and app.yaml as indicated at https://cloud.google.com/nodejs/getting-started/using-pub-sub (4) npm install

I got error: zijihgo@sanguine-willow-112918:~/6-pubsub$ npm install

sse4_crc32@4.1.1 install /home/zijihgo/6-pubsub/node_modules/gcloud/node_modules/hash-stream- validation/node_modules/fast-crc32c/node_modules/sse4_crc32 node-gyp rebuild gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: read ECONNRESET gyp ERR! stack at exports._errnoException (util.js:746:11) gyp ERR! stack at TCP.onread (net.js:559:26) gyp ERR! System Linux 3.16.0-0.bpo.4-amd64 gyp ERR! command "node" "/usr/local/nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules /node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/zijihgo/6-pubsub/node_modules/gcloud/node_modules/hash-stream-validation/nod e_modules/fast-crc32c/node_modules/sse4_crc32 gyp ERR! node -v v0.12.2 gyp ERR! node-gyp -v v1.0.3 gyp ERR! not ok npm WARN optional dep failed, continuing sse4_crc32@4.1.1 npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

Thanks,

JustinBeckwith commented 8 years ago

This should be fixed here: https://github.com/GoogleCloudPlatform/nodejs-docker/commit/0722fe884ad0c7c2321c7c76af028f1d999f343e

@dlorenc - when do you think that should go out?

zijih commented 8 years ago

Can someone deploy the change? I am not able to remove ver 0.12.2. I tried to install ver 4.2.2 using nvm but got denied. zijihgo@sanguine-willow-112918:~$ nvm install 4.2.2 mkdir: cannot create directory ‘/usr/local/nvm/bin/node-v4.2.2-linux-x64’: Permission deniedgrep: /usr/local/nvm/bin/node-v4.2.2-linux-x64/node-v4.2.2-linux-x64.tar.gz: No such file or directoryBinary download failed, trying source.mkdir: cannot create directory ‘/usr/local/nvm/bin/node-v4.2.2-linux-x64’: Permission deniedgrep: /usr/local/nvm/bin/node-v4.2.2-linux-x64/node-v4.2.2-linux-x64.tar.gz: No such file or directoryBinary download failed, trying source.Installing node v1.0 and greater from source is not currently supported Thanks,

Ziji

On Mon, Nov 16, 2015 at 5:01 PM, Justin Beckwith notifications@github.com wrote:

This should be fixed here: GoogleCloudPlatform/nodejs-docker@0722fe8 https://github.com/GoogleCloudPlatform/nodejs-docker/commit/0722fe884ad0c7c2321c7c76af028f1d999f343e

@dlorenc https://github.com/dlorenc - when do you think that should go out?

— Reply to this email directly or view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32#issuecomment-157225323 .

JustinBeckwith commented 8 years ago

Our fix to the base nodejs-docker image is out - the mongodb package shouldn't give warnings now. I'm a little confused about your nvm question.

Can you install 4.2.2 using the standard nodejs installer here? https://nodejs.org/en/

JustinBeckwith commented 8 years ago

Doing some clean up - let us know if this is still an issue!

zijih commented 8 years ago

I tried using commands at https://nodejs.org/en/download/package-manager/:

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

That installs Node 4.2.2, but I have to start 4.2.2 using command nodejs, not node. When I use command node, the 0.12.2 gets started. It seems node 0.12.2 exists in system by default. I tried to remove 0.12.2 using "sudo apt-get remove node" or "sudo apt-get --purge remove node", but the 0.12.2 did not get removed. However, I can remove 4.2.2, using "sudo apt-get remove nodejs".

You can verify that by using commands "whereis node" and "node -v".

That is the main issue keeps bothering me. And it happens on both Compute Engine and App Engine.

Can you please instruct how to remove node 0.12.2?

Thanks,

Ziji

On Tue, Dec 1, 2015 at 4:01 PM, Justin Beckwith notifications@github.com wrote:

Closed #32 https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32.

— Reply to this email directly or view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32#event-479617627 .

theacodes commented 8 years ago

I'm unsure how you got node v0.12.2 installed in /usr/bin/node

There's a weird history with Node.js on debian systems. TL;DR, the package maintainers renamed the node executable to nodejs to avoid conflicting with an existing package for amateur radios. This broke stuff. You should be able to do

sudo apt-get install node-legacy

This should symlink /usr/bin/nodejs to /usr/bin/node.

See http://stackoverflow.com/questions/21168141/can-not-install-packages-using-node-package-manager-in-ubuntu

JustinBeckwith commented 8 years ago

Just to make sure I understand what's happening.... are we talking about errors that happen when you deploy your application to the container on App Engine, or about your local machine?

If it's your local machine - which OS are you running?

If it's on App Engine - can you share your dockerfile?

zijih commented 8 years ago

Hi Jonathan and Justin, Thanks for looking at the issue I am having. As for node v 0.12.2, I do not know how it went there. I notice it was there in the beginning of the App Engine after I created an project. The first project I created was for a sample Hello World Node downloaded from https://cloud.google.com/nodejs/getting-started/hello-world. There was no problem running that one on the App Engine. Then I created a project for the sample Bookshelf App following https://cloud.google.com/nodejs/getting-started/tutorial-app. I used the Cloud Shell to do all the steps on the App Engine (zijihgo@sanguine-willow-112918) . At the section of Pub/Sub ( https://cloud.google.com/nodejs/getting-started/using-pub-sub#download_app,), I downloaded App, configured settings and ran npm install, followed by npm start. I got "App listening at http://:::8080 ". When I clicked "Web Preview" to access the site, I got error message at browser: Error: Could not connect to Cloud Shell on port 8080. I checked the Cloud Shell and saw a bunch of error messages, showing node v 0.12.2 was executed.

...... npm ERR! Linux 3.16.0-0.bpo.4-amd64 npm ERR! argv "/usr/local/nvm/versions/node/v0.12.2/bin/node" "/usr/local/nvm/versions/node/v0.12.2/bin/npm" "start" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! code ELIFECYCLE npm ERR! nodejs-getting-started@1.0.0 start: node ${SCRIPT:-app.js} npm ERR! Exit status 1 .....

Even I tried installing 4.2.2, that did not help because node was linked to v 0.12.2.

I then tried Compute Engine. The OS I chose was Debian GNU/Linux 8 (jessie). The machine type I chose was https://www.googleapis.com/compute/v1/projects/nodewithredis/zones/us-central1-a/machineTypes/n1-standard-1, and operation id: operation-1447986070810-524ef8763ed91-6a502149-ef079e64 . I found node v 0.12.2 was installed by default there as well and could not be removed. Even I could install 4.2.2, I had to use nodejs to launch 4.2.2, but that was not what I wanted.

Since both App Engine (zijihgo@sanguine-willow-112918) and Compute Engine (zijihgo@nodewithredis) do not have my private code, please feel free to access them, check and change as you wish.

Thanks,

Ziji

On Wed, Dec 2, 2015 at 1:33 PM, Justin Beckwith notifications@github.com wrote:

Just to make sure I understand what's happening.... are we talking about errors that happen when you deploy your application to the container on App Engine, or about your local machine?

If it's your local machine - which OS are you running?

If it's on App Engine - can you share your dockerfile?

— Reply to this email directly or view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32#issuecomment-161440577 .

zijih commented 8 years ago

Sorry, I am wrong on NodeJS at Compute Engine. Node 4.2.2 runs on the Compute Engine properly, both node -v and nodejs -v show 4.2.2. Thanks,

Ziji

On Wed, Dec 2, 2015 at 6:16 PM, ZIJI HUANG zijihgo@gmail.com wrote:

Hi Jonathan and Justin, Thanks for looking at the issue I am having. As for node v 0.12.2, I do not know how it went there. I notice it was there in the beginning of the App Engine after I created an project. The first project I created was for a sample Hello World Node downloaded from https://cloud.google.com/nodejs/getting-started/hello-world. There was no problem running that one on the App Engine. Then I created a project for the sample Bookshelf App following https://cloud.google.com/nodejs/getting-started/tutorial-app. I used the Cloud Shell to do all the steps on the App Engine (zijihgo@sanguine-willow-112918) . At the section of Pub/Sub ( https://cloud.google.com/nodejs/getting-started/using-pub-sub#download_app,), I downloaded App, configured settings and ran npm install, followed by npm start. I got "App listening at http://:::8080 ". When I clicked "Web Preview" to access the site, I got error message at browser: Error: Could not connect to Cloud Shell on port 8080. I checked the Cloud Shell and saw a bunch of error messages, showing node v 0.12.2 was executed.

...... npm ERR! Linux 3.16.0-0.bpo.4-amd64 npm ERR! argv "/usr/local/nvm/versions/node/v0.12.2/bin/node" "/usr/local/nvm/versions/node/v0.12.2/bin/npm" "start" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! code ELIFECYCLE npm ERR! nodejs-getting-started@1.0.0 start: node ${SCRIPT:-app.js} npm ERR! Exit status 1 .....

Even I tried installing 4.2.2, that did not help because node was linked to v 0.12.2.

I then tried Compute Engine. The OS I chose was Debian GNU/Linux 8 (jessie). The machine type I chose was https://www.googleapis.com/compute/v1/projects/nodewithredis/zones/us-central1-a/machineTypes/n1-standard-1, and operation id: operation-1447986070810-524ef8763ed91-6a502149-ef079e64 . I found node v 0.12.2 was installed by default there as well and could not be removed. Even I could install 4.2.2, I had to use nodejs to launch 4.2.2, but that was not what I wanted.

Since both App Engine (zijihgo@sanguine-willow-112918) and Compute Engine (zijihgo@nodewithredis) do not have my private code, please feel free to access them, check and change as you wish.

Thanks,

Ziji

On Wed, Dec 2, 2015 at 1:33 PM, Justin Beckwith notifications@github.com wrote:

Just to make sure I understand what's happening.... are we talking about errors that happen when you deploy your application to the container on App Engine, or about your local machine?

If it's your local machine - which OS are you running?

If it's on App Engine - can you share your dockerfile?

— Reply to this email directly or view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32#issuecomment-161440577 .

zijih commented 8 years ago

The issue occurs at App Engine VM: dev-con-cloud-devshell-6831-devshell-vm-9ff10b4e-7a05-4065-a5b8, OS: Debian GNU/Linux 8 (jessie) My Compute Engine does not have the issue. It has OS: Ubuntu 14.04.3 LTS. Thanks,

Ziji

On Wed, Dec 2, 2015 at 9:05 PM, ZIJI HUANG zijihgo@gmail.com wrote:

Sorry, I am wrong on NodeJS at Compute Engine. Node 4.2.2 runs on the Compute Engine properly, both node -v and nodejs -v show 4.2.2. Thanks,

Ziji

On Wed, Dec 2, 2015 at 6:16 PM, ZIJI HUANG zijihgo@gmail.com wrote:

Hi Jonathan and Justin, Thanks for looking at the issue I am having. As for node v 0.12.2, I do not know how it went there. I notice it was there in the beginning of the App Engine after I created an project. The first project I created was for a sample Hello World Node downloaded from https://cloud.google.com/nodejs/getting-started/hello-world. There was no problem running that one on the App Engine. Then I created a project for the sample Bookshelf App following https://cloud.google.com/nodejs/getting-started/tutorial-app. I used the Cloud Shell to do all the steps on the App Engine (zijihgo@sanguine-willow-112918) . At the section of Pub/Sub ( https://cloud.google.com/nodejs/getting-started/using-pub-sub#download_app,), I downloaded App, configured settings and ran npm install, followed by npm start. I got "App listening at http://:::8080 ". When I clicked "Web Preview" to access the site, I got error message at browser: Error: Could not connect to Cloud Shell on port 8080. I checked the Cloud Shell and saw a bunch of error messages, showing node v 0.12.2 was executed.

...... npm ERR! Linux 3.16.0-0.bpo.4-amd64 npm ERR! argv "/usr/local/nvm/versions/node/v0.12.2/bin/node" "/usr/local/nvm/versions/node/v0.12.2/bin/npm" "start" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! code ELIFECYCLE npm ERR! nodejs-getting-started@1.0.0 start: node ${SCRIPT:-app.js} npm ERR! Exit status 1 .....

Even I tried installing 4.2.2, that did not help because node was linked to v 0.12.2.

I then tried Compute Engine. The OS I chose was Debian GNU/Linux 8 (jessie). The machine type I chose was https://www.googleapis.com/compute/v1/projects/nodewithredis/zones/us-central1-a/machineTypes/n1-standard-1, and operation id: operation-1447986070810-524ef8763ed91-6a502149-ef079e64 . I found node v 0.12.2 was installed by default there as well and could not be removed. Even I could install 4.2.2, I had to use nodejs to launch 4.2.2, but that was not what I wanted.

Since both App Engine (zijihgo@sanguine-willow-112918) and Compute Engine (zijihgo@nodewithredis) do not have my private code, please feel free to access them, check and change as you wish.

Thanks,

Ziji

On Wed, Dec 2, 2015 at 1:33 PM, Justin Beckwith <notifications@github.com

wrote:

Just to make sure I understand what's happening.... are we talking about errors that happen when you deploy your application to the container on App Engine, or about your local machine?

If it's your local machine - which OS are you running?

If it's on App Engine - can you share your dockerfile?

— Reply to this email directly or view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32#issuecomment-161440577 .

zijih commented 8 years ago

Here is an update on my experience of running "sudo apt-get install nodejs-legacy" today: On the App Engine VM (dev-con-cloud-devshell-6831-devshell-vm-9ff10b4e-7a05-4065-a5b8), I removed NodeJS v4.2.2, leaving v0.12.2 (could not remove it). I ran "sudo apt-get install nodejs-legacy". After installation, I ran node -v, got v0.12.2. I ran nodejs -v, got v0.10.29. I ran "sudo apt-get remove nodejs", that removed v0.10.29, but v0.12.2 stayed. I ran "sudo apt-get remove node", got: Package 'node' is not installed, so not removed. I ran node -v, still got v0.12.2. I ran whereis node, got: node: /usr/local/nvm/versions/node/v0.12.2/bin/node It seems Debian on App Engine has some problems with Node JS. Thanks,

Ziji

On Wed, Dec 2, 2015 at 9:18 PM, ZIJI HUANG zijihgo@gmail.com wrote:

The issue occurs at App Engine VM: dev-con-cloud-devshell-6831-devshell-vm-9ff10b4e-7a05-4065-a5b8, OS: Debian GNU/Linux 8 (jessie) My Compute Engine does not have the issue. It has OS: Ubuntu 14.04.3 LTS. Thanks,

Ziji

On Wed, Dec 2, 2015 at 9:05 PM, ZIJI HUANG zijihgo@gmail.com wrote:

Sorry, I am wrong on NodeJS at Compute Engine. Node 4.2.2 runs on the Compute Engine properly, both node -v and nodejs -v show 4.2.2. Thanks,

Ziji

On Wed, Dec 2, 2015 at 6:16 PM, ZIJI HUANG zijihgo@gmail.com wrote:

Hi Jonathan and Justin, Thanks for looking at the issue I am having. As for node v 0.12.2, I do not know how it went there. I notice it was there in the beginning of the App Engine after I created an project. The first project I created was for a sample Hello World Node downloaded from https://cloud.google.com/nodejs/getting-started/hello-world. There was no problem running that one on the App Engine. Then I created a project for the sample Bookshelf App following https://cloud.google.com/nodejs/getting-started/tutorial-app. I used the Cloud Shell to do all the steps on the App Engine (zijihgo@sanguine-willow-112918) . At the section of Pub/Sub ( https://cloud.google.com/nodejs/getting-started/using-pub-sub#download_app,), I downloaded App, configured settings and ran npm install, followed by npm start. I got "App listening at http://:::8080 ". When I clicked "Web Preview" to access the site, I got error message at browser: Error: Could not connect to Cloud Shell on port 8080. I checked the Cloud Shell and saw a bunch of error messages, showing node v 0.12.2 was executed.

...... npm ERR! Linux 3.16.0-0.bpo.4-amd64 npm ERR! argv "/usr/local/nvm/versions/node/v0.12.2/bin/node" "/usr/local/nvm/versions/node/v0.12.2/bin/npm" "start" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! code ELIFECYCLE npm ERR! nodejs-getting-started@1.0.0 start: node ${SCRIPT:-app.js} npm ERR! Exit status 1 .....

Even I tried installing 4.2.2, that did not help because node was linked to v 0.12.2.

I then tried Compute Engine. The OS I chose was Debian GNU/Linux 8 (jessie). The machine type I chose was https://www.googleapis.com/compute/v1/projects/nodewithredis/zones/us-central1-a/machineTypes/n1-standard-1, and operation id: operation-1447986070810-524ef8763ed91-6a502149-ef079e64 . I found node v 0.12.2 was installed by default there as well and could not be removed. Even I could install 4.2.2, I had to use nodejs to launch 4.2.2, but that was not what I wanted.

Since both App Engine (zijihgo@sanguine-willow-112918) and Compute Engine (zijihgo@nodewithredis) do not have my private code, please feel free to access them, check and change as you wish.

Thanks,

Ziji

On Wed, Dec 2, 2015 at 1:33 PM, Justin Beckwith < notifications@github.com> wrote:

Just to make sure I understand what's happening.... are we talking about errors that happen when you deploy your application to the container on App Engine, or about your local machine?

If it's your local machine - which OS are you running?

If it's on App Engine - can you share your dockerfile?

— Reply to this email directly or view it on GitHub https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/32#issuecomment-161440577 .