'colors' error message on google-cloud-datastore-tutorial

Hello,

I am working to get the google-cloud-datastore-tutorial running but have hit a wall that I can’t seem to get around. when running the node tutorial.js I get the below error message:

brain:~ Zeytin$ npm install
brain:~ Zeytin$ node tutorial.js
module.js:487
    throw err;
    ^

Error: Cannot find module 'colors'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/Zeytin/tutorial.js:1:76)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

I think maybe because I am in the wrong cd? @kennethlimcp sorry to bug you with this but you do know my situation (or last one) rather well.

Any thoughts on whats going on?

Which tutorial is that? Have a link?

Hi @kennethlimcp

Thank you for the reply! I am working to store data from the SHT10 temperature and humidity on the google cloud. I tried ThingSpeak but was unsuccessful with the setup and now am trying google cloud but am still having trouble. I really am a noob:( The link is below for the tutorial I was working on.

https://github.com/spark/google-cloud-datastore-tutorial

Did you do a npm install in that directory containing all the project files? Was there any error?

below is a screenshot of the files in the ~Zeytin directory which I believe is where the npm install is taking place?

This is what I get back after I run the commands:

brain:~ Zeytin$ npm install
brain:~ Zeytin$ node tutorial.js
module.js:487
    throw err;
    ^

Error: Cannot find module 'colors'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/Zeytin/tutorial.js:1:76)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3) 

You will want to be in the cloud-google-datastore-tutorial folder.

Hi @kennethlimcp

Ok, I cd to the cloud-google-datastore-tutorial folder and used the npm install command but it gives me the same errors as I had gotten before when trying to install the particle-cli. See below.

brain:google-cloud-datastore-tutorial Zeytin$ npm install
npm WARN deprecated google-cloud@0.40.0: The google-cloud meta-package is not recommended; install individual packages.
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/Cellar/node/8.2.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v8.2.1
npm ERR! npm  v3.10.10

npm ERR! Invalid name: "@google-cloud/common"
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Zeytin/google-cloud-datastore-tutorial/npm-debug.log

I don’t know why but I cannot get anything to work correctly. Is it the fact that Im on a mac or just because Im new to all of this? I follow all of the tutorials exactly as they say!

Grrr…

Works fine on my Mac but using v6.x.x of nodeJS.

Install nvm manager which allows you to switch between nodeJS versions.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Then try doing this:

nvm install v6

nvm use v6

rm -rf node_modules

sudo npm install

Hey so here is what happened!

brain:google-cloud-datastore-tutorial Zeytin$ rm -rf node_modules
brain:google-cloud-datastore-tutorial Zeytin$ sudo npm install
Password:
npm WARN deprecated google-cloud@0.40.0: The google-cloud meta-package is not recommended; install individual packages.
npm ERR! Darwin 16.6.0
npm ERR! argv “/usr/local/Cellar/node/8.2.1/bin/node” “/usr/local/bin/npm” "install"
npm ERR! node v8.2.1
npm ERR! npm v3.10.10

npm ERR! Invalid name: "@google-cloud/bigquery"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Zeytin/google-cloud-datastore-tutorial/npm-debug.log

See above updated post.

brain:google-cloud-datastore-tutorial Zeytin$ nvm install v6
-bash: nvm: command not found

Please read and follow the full instruction above.

oh sorry I missed the first part.

You are going to hate me but I have no idea how to install that. Do I enter that link into my terminal and under the same directory as I am in now?

That’s correct.

got it… ok here is what happened. I stopped at nvm install v6 because I got the command not found reply

brain:google-cloud-datastore-tutorial Zeytin$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh1 | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15  100    15    0     0    103      0 --:--:-- --:--:-- --:--:--   104
bash: line 1: 404:: command not found
brain:google-cloud-datastore-tutorial Zeytin$ nvm install v6
-bash: nvm: command not found

It’s the issue with the command have an extra number:

Try this:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

ok…

brain:google-cloud-datastore-tutorial Zeytin$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11699 100 11699 0 0 85427 0 --:–:-- --:–:-- --:–:-- 86022
=> Downloading nvm from git to ‘/Users/Zeytin/.nvm’
=> Cloning into ‘/Users/Zeytin/.nvm’…
remote: Counting objects: 6495, done.
remote: Total 6495 (delta 0), reused 0 (delta 0), pack-reused 6495
Receiving objects: 100% (6495/6495), 1.94 MiB | 0 bytes/s, done.
Resolving deltas: 100% (4026/4026), done.

  • (HEAD detached at v0.33.2)
    master
    => Compressing and cleaning up git repository
    Counting objects: 6495, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (6451/6451), done.
    Writing objects: 100% (6495/6495), done.
    Total 6495 (delta 4285), reused 2001 (delta 0)

=> Appending nvm source string to /Users/Zeytin/.bash_profile
=> Appending bash_completion source string to /Users/Zeytin/.bash_profile
npm ERR! extraneous: ansi@0.2.1 /usr/local/lib/node_modules/npm/node_modules/ansi
npm ERR! extraneous: block-stream@0.0.7 /usr/local/lib/node_modules/npm/node_modules/block-stream
npm ERR! extraneous: call-limit@1.1.0 /usr/local/lib/node_modules/npm/node_modules/call-limit
npm ERR! extraneous: char-spinner@1.0.1 /usr/local/lib/node_modules/npm/node_modules/char-spinner
npm ERR! extraneous: child-process-close@0.1.1 /usr/local/lib/node_modules/npm/node_modules/child-process-close
npm ERR! extraneous: chmodr@0.1.0 /usr/local/lib/node_modules/npm/node_modules/chmodr
npm ERR! extraneous: detect-indent@5.0.0 /usr/local/lib/node_modules/npm/node_modules/detect-indent
npm ERR! extraneous: JSONStream@1.3.1 /usr/local/lib/node_modules/npm/node_modules/JSONStream
npm ERR! extraneous: lazy-property@1.0.0 /usr/local/lib/node_modules/npm/node_modules/lazy-property
npm ERR! extraneous: libnpx@9.2.0 /usr/local/lib/node_modules/npm/node_modules/libnpx
npm ERR! extraneous: lodash._baseindexof@3.1.0 /usr/local/lib/node_modules/npm/node_modules/lodash._baseindexof
npm ERR! extraneous: lodash._bindcallback@3.0.1 /usr/local/lib/node_modules/npm/node_modules/lodash._bindcallback
npm ERR! extraneous: lodash._cacheindexof@3.0.2 /usr/local/lib/node_modules/npm/node_modules/lodash._cacheindexof
npm ERR! extraneous: lodash._createcache@3.1.2 /usr/local/lib/node_modules/npm/node_modules/lodash._createcache
npm ERR! extraneous: lodash.restparam@3.6.1 /usr/local/lib/node_modules/npm/node_modules/lodash.restparam
npm ERR! extraneous: minimatch@0.3.0 /usr/local/lib/node_modules/npm/node_modules/minimatch
npm ERR! extraneous: npmconf@1.0.1 /usr/local/lib/node_modules/npm/node_modules/npmconf
npm ERR! extraneous: pacote@2.7.38 /usr/local/lib/node_modules/npm/node_modules/pacote
npm ERR! extraneous: sorted-union-stream@2.1.3 /usr/local/lib/node_modules/npm/node_modules/sorted-union-stream
npm ERR! extraneous: uuid@3.1.0 /usr/local/lib/node_modules/npm/node_modules/uuid
npm ERR! extraneous: worker-farm@1.4.1 /usr/local/lib/node_modules/npm/node_modules/worker-farm
npm ERR! invalid: normalize-package-data@0.2.13 /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data
npm ERR! missing: semver@2, required by normalize-package-data@0.2.13
npm ERR! extraneous: github-url-from-git@1.1.1 /usr/local/lib/node_modules/npm/node_modules/github-url-from-git
npm ERR! extraneous: github-url-from-username-repo@0.1.0 /usr/local/lib/node_modules/npm/node_modules/github-url-from-username-repo
npm ERR! extraneous: mime@1.2.11 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/mime
npm ERR! extraneous: performance-now@0.2.0 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/performance-now
npm ERR! extraneous: async@0.2.9 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/form-data/node_modules/async
npm ERR! invalid: combined-stream@0.0.4 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream
npm ERR! extraneous: delayed-stream@0.0.5 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream
npm ERR! extraneous: ajv@4.11.8 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/har-validator/node_modules/ajv
npm ERR! extraneous: har-schema@1.0.5 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/har-validator/node_modules/har-schema
npm ERR! extraneous: asn1@0.1.11 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/asn1
npm ERR! extraneous: ctype@0.5.2 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/ctype
npm ERR! extraneous: assert-plus@1.0.0 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/assert-plus
npm ERR! extraneous: punycode@1.2.3 /usr/local/lib/node_modules/npm/node_modules/request/node_modules/tough-cookie/node_modules/punycode
npm ERR! invalid: readable-stream@1.0.24 /usr/local/lib/node_modules/npm/node_modules/sha/node_modules/readable-stream
npm ERR! invalid: ansi-regex@3.0.0 /usr/local/lib/node_modules/npm/node_modules/strip-ansi/node_modules/ansi-regex
=> You currently have modules installed globally with npm. These will no
=> longer be linked to the active version of Node when you install a new node
=> with nvm; and they may (depending on how you construct your $PATH)
=> override the binaries of modules installed with nvm:

/usr/local/lib
├── bootstrap@4.0.0-alpha.6
├── colors@1.1.2
├── json@9.0.6
├── particle-cli@1.23.1
└── serialport@5.0.0
=> If you wish to uninstall them at a later point (or re-install them under your
=> nvm Nodes), you can remove them from the system Node as follows:

 $ nvm use system
 $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh” # This loads nvm
[ -s “$NVM_DIR/bash_completion” ] && . “$NVM_DIR/bash_completion” # This loads nvm bash_completion
brain:google-cloud-datastore-tutorial Zeytin$ nvm install v6
-bash: nvm: command not found

did you do this?

just did… what it spit out is really really long. Is there a way to post a file vs posting the long reply?

you can use the following syntax

paste logs here