dwyl / javascript-todo-list-tutorial

βœ… A step-by-step complete beginner example/tutorial for building a Todo List App (TodoMVC) from scratch in JavaScript following Test Driven Development (TDD) best practice. 🌱
https://dwyl.github.io/javascript-todo-list-tutorial
GNU General Public License v2.0
618 stars 102 forks source link

Running test set up throwing error message #10

Closed shellhatcher closed 5 years ago

shellhatcher commented 5 years ago

Hi,

I tried to run the code given for the test set up purpose using node test/todo-app.test.js that should return nothing, but I got the following error messages internal/modules/cjs/loader.js:615 throw err; ^

Error: Cannot find module 'tape' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15) at Function.Module._load (internal/modules/cjs/loader.js:539:25) at Module.require (internal/modules/cjs/loader.js:667:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (/Users/babydust/Desktop/todolist_mvc/test/todo-app.test.js:1:76) at Module._compile (internal/modules/cjs/loader.js:738:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10) at Module.load (internal/modules/cjs/loader.js:630:32) at tryModuleLoad (internal/modules/cjs/loader.js:570:12) at Function.Module._load (internal/modules/cjs/loader.js:562:3)

What might cause this problem to occur? Thank you in advance for your assistance.

nelsonic commented 5 years ago

Hi @shellhatcher, welcome to @dwyl! Stoked you found our todo-list tutorial.πŸ‘ It appears as though you don't have the dependencies installed, specifically tape which runs the tests. Please Try running nom npm install in your terminal.

shellhatcher commented 5 years ago

Hi, Nelson

Great to have such a swift reply from you, really appreciate that:)

I'll try to run non install and let you know the result afterward.

2019εΉ΄2月25ζ—₯(月) 17:14 Nelson notifications@github.com:

Hi @shellhatcher https://github.com/shellhatcher, welcome to @dwyl https://github.com/dwyl! Stoked you found our todo-list tutorial.πŸ‘ It appears as though you don't have the dependencies installed, specifically tape which runs the tests. Please Try running nom install in your terminal.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dwyl/todo-list-javascript-tutorial/issues/10#issuecomment-466911689, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfZgwe4b5sQl6M-2HyShRET_8UveTBPks5vQ5tkgaJpZM4bPBFl .

shellhatcher commented 5 years ago

I am sorry, was it nom install or npm install?

2019εΉ΄2月25ζ—₯(月) 21:27 sweetandsour 1001 sweetandsour1001@gmail.com:

Hi, Nelson

Great to have such a swift reply from you, really appreciate that:)

I'll try to run non install and let you know the result afterward.

2019εΉ΄2月25ζ—₯(月) 17:14 Nelson notifications@github.com:

Hi @shellhatcher https://github.com/shellhatcher, welcome to @dwyl https://github.com/dwyl! Stoked you found our todo-list tutorial.πŸ‘ It appears as though you don't have the dependencies installed, specifically tape which runs the tests. Please Try running nom install in your terminal.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dwyl/todo-list-javascript-tutorial/issues/10#issuecomment-466911689, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfZgwe4b5sQl6M-2HyShRET_8UveTBPks5vQ5tkgaJpZM4bPBFl .

fmoliveira commented 5 years ago

Hi @shellhatcher, it's npm install. Please try running it and let us know. :)

nelsonic commented 5 years ago

@shellhatcher that was Android auto-correcting "npm" to "nom" ... πŸ™„ it needs to be npm install as @fmoliveira kindly corrected. πŸ‘

shellhatcher commented 5 years ago

Thanks Felipe and Nelson

My keyboard also does autocorrect often, I can understand that:)

Before I did the npm install, I checked it's availability by using npm -v, and the terminal gave me its version, which means it already there.

So, do I still need to run npm install on the terminal?

Thank you

2019εΉ΄2月25ζ—₯(月) 23:33 Nelson notifications@github.com:

@shellhatcher https://github.com/shellhatcher that was Android auto-correcting "npm" to "nom" ... πŸ™„ it needs to be npm install as @fmoliveira https://github.com/fmoliveira kindly corrected. πŸ‘

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dwyl/todo-list-javascript-tutorial/issues/10#issuecomment-467032833, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfZg8cAK8ZTpYzEJvwxcbG0-Jp-Z5w6ks5vQ_QhgaJpZM4bPBFl .

fmoliveira commented 5 years ago

@shellhatcher The command npm -v will output the installed version of npm, the Node.js Package Manager itself, not anything related to tape. So, running npm -v isn't sufficient to tell if you've got tape installed.

To check if you've got tape installed in your current repository, check your node_modules folder, that should be in the same level as your package.json file. Does this folder exist? Does a tape folder exist inside it? If yes, then tape is installed, and you shouldn't need to run npm install again.

shellhatcher commented 5 years ago

Thanks Filipe,

I got everything now, tape is installed in the todolist-javascript-tutorial cloned from your repo.

There is a CREATE FILE step which asked to make the three files

  1. test/todo-app.test.js 2.lib/todo-app.js 3.index.html

Question is :

  1. Should create these files in a new directory separated from the one I cloned from your repo( todolist-javascript-tutorial) ?

  2. And if so, do I need to run npm install in this directory? Actually, I did run npm install in this new directory, but can't get the tape installed. Hence I still got the same error message. Any suggestion?

  3. Or within the same directory with the one I cloned from your repo (todolist-javascript-tutorial) ? But, this one is impossible, since all those three files are there already.

  4. I am now trying to read your TDD tutorial to try to understand about this testing stuff, did I go the right direction?

  5. Any suggestion what need to be done before jumping into this tutorial to smoothen the process in following the todolist MVC vanilla JS tutorial?

Many thanks in advance, and pardon for me asking too many questions.

2019εΉ΄2月26ζ—₯(火) 12:28 Filipe Oliveira notifications@github.com:

@shellhatcher https://github.com/shellhatcher The command npm -v will output the installed version of npm, the Node.js Package Manager itself, not anything related to tape. So, running npm -v isn't sufficient to tell if you've got tape installed.

To check if you've got tape installed in your current repository, check your node_modules folder, that should be in the same level as your package.json file. Does this folder exist? Does a tape folder exist inside it? If yes, then tape is installed, and you shouldn't need to run npm install again.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dwyl/todo-list-javascript-tutorial/issues/10#issuecomment-467279576, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfZg5kBkI8vE4I5T1ssJ_nJgrqSKbrhks5vRKnUgaJpZM4bPBFl .

Jbarget commented 5 years ago

@shellhatcher the answer is 3.

The 3 files need to be within the directory so that the code has access to the node_modules directory. The node_modules directory contains all the "dependencies" for the project. (If you had a different project, they would likely have different "dependencies" and therefore the contents of the node_modules directory would be different too.)

You can see these in the package.json file under dependencies and devDependencies. And you can think of the package.json as a whole as the ingredients list for the project.

Questions are fine :) If you have any suggestions for us on how to make the README clearer let us know!

shellhatcher commented 5 years ago

Thank you very much Justen Barget for the answer. I did your suggestion and it worked fine now:) -But I changed the name of the files, since the files names asked are all already existed inside the todo-list-javascript-tutorial directory.

In my humble opinion as a total beginner, probably the following could be used to make the README totally beginner friendly:

  1. The HOW? section should be numbered in order, so it will be easy for us to follow along spot at which step we are.
  2. I think putting the seemingly unrelated information in the middle of the HOW? step will cause distraction, for example at the README after the first HOW? section, all of a sudden we are introduced with Elm(ish) ?. I think all of the necessary additional information/ the explanation on a certain buzz words should be group on their own.

Probably that's all for now, since I haven't moved further. Later down the road, if I find something else I will raise an issue and probably I'll be able to give more suggestions seen from newbie point of view.

I do really appreciate great support from all of you guys:)

nelsonic commented 5 years ago

@shellhatcher thanks for the incredibly valuable feedback! πŸŽ‰

shellhatcher commented 5 years ago

οΌ Nelson and all of the others

It was nothing compared to your noble willingness to share your knowledge and to give the support:)

2019εΉ΄2月26ζ—₯(火) 20:49 Nelson notifications@github.com:

@shellhatcher https://github.com/shellhatcher thanks for the incredibly valuable feedback! πŸŽ‰

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dwyl/todo-list-javascript-tutorial/issues/10#issuecomment-467408528, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfZg1jzAKZ5TLP48Z81xfOdsLQLqlIDks5vRR9YgaJpZM4bPBFl .

nelsonic commented 5 years ago

@shellhatcher please confirm if you were able to get the example (and tests) running. (if you were, please consider commenting and closing this issue, thanks!) ✨

shellhatcher commented 5 years ago

@nelsonic, Pardon me for haven't closed the issue yet. I have successfully got the example and tests running since 25 days ago thanks to all of your swift supports:)