Description
I got stuck at number 5 (How to run tests)
**5. In another terminal, run the unit tests from the root of the project :**
I am assuming that the root of the project refers to the Google Cloud Storage project folder storage in nodejs-docs-samples.
- Users/me/Downloads/nodejs-docs-samples/storage
- npm install in the directory above
- npm test
- npm test leads to this error (Error: Cannot find module ‘intelli-espower-loader’):
> nodejs-docs-samples-storage@0.0.1 test /Users/me/Downloads/nodejs-docs-samples/storage
> mocha -R spec -t 120000 --require intelli-espower-loader ../test/_setup.js test/*.test.js
module.js:327
throw err;
^
Error: Cannot find module 'intelli-espower-loader'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /Users/me/Downloads/nodejs-docs-samples/storage/node_modules/mocha/bin/_mocha:344:3
at Array.forEach (native)
at Object.<anonymous> (/Users/me/Downloads/nodejs-docs-samples/storage/node_modules/mocha/bin/_mocha:343:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
npm ERR! Test failed. See above for more details.
So this page here https://github.com/power-assert-js/intelli-espower-loader
provides the missing module including the module power-assert :
- npm install intelli-espower-loader --save-dev
- npm install power-assert --save-dev
- I run npm test again
Although I installed the module power-asset along with intelli-espower-loader earlier, terminal throws me the (Error: Cannot find module ‘power-asset’) again when running npm test :
> nodejs-docs-samples-storage@0.0.1 test /Users/me/Downloads/nodejs-docs-samples/storage
> mocha -R spec -t 120000 ../test/_setup.js test/*.test.js
module.js:327
throw err;
^
Error: Cannot find module 'power-assert'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/me/Downloads/nodejs-docs-samples/test/_setup.js:16:14)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /Users/me/Downloads/nodejs-docs-samples/storage/node_modules/mocha/lib/mocha.js:222:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/me/Downloads/nodejs-docs-samples/storage/node_modules/mocha/lib/mocha.js:219:14)
at Mocha.run (/Users/me/Downloads/nodejs-docs-samples/storage/node_modules/mocha/lib/mocha.js:487:10)
at Object.<anonymous> (/Users/me/Downloads/nodejs-docs-samples/storage/node_modules/mocha/bin/_mocha:458:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
npm ERR! Test failed. See above for more details.
My attempts to uninstall and reinstall the power-assert module failed :
https://docs.npmjs.com/cli/uninstall
Also doing the commands in the storage folder suggested here did not work for me :
http://stackoverflow.com/questions/9023672/nodejs-how-to-resolve-cannot-find-module-error
- rm -rf node_modules
- npm install
My package.json in the storage folder looks like this:
{
"name": "nodejs-docs-samples-storage",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"scripts": {
"test": "mocha -R spec -t 120000 ../test/_setup.js test/*.test.js",
"system-test": "mocha -R spec -t 120000 ../system-test/_setup.js system-test/*.test.js"
},
"dependencies": {
"@google-cloud/storage": "^0.2.0",
"googleapis": "^13.0.0",
"moment": "^2.15.1",
"yargs": "^6.0.0"
},
"devDependencies": {
"babel-preset-power-assert": "^1.0.0",
"intelli-espower-loader": "^1.0.1",
"mocha": "^3.1.0",
"node-uuid": "^1.4.7",
"power-assert": "^1.4.1"
},
"engines": {
"node": ">=4.3.2"
}
}
Why does NPM not find the module power-assert which is installed and present in the node_modules file of the storage folder?
Am I pointing to the right directory, anyway?
I am thankful for any hints.