Quote Keeper: bin/mocha-test: Permission denied

Learn Model Testing TDD : Quote Keeper Project

https://www.codecademy.com/paths/web-development/tracks/test-driven-development-javascript/modules/learn-tdd-testing-models/projects/tdd-model-proj

I had this problem on another project (Dino one). When I try to do the project on my laptop and run npm test I get this error:

> calculator-js@0.0.0 test /home/xxxxxxxx/Coding Projects/Web Development/Feature_Server_Model_Test_Quote_Keeper
> bin/mocha-test && PORT=8001 bin/wdio-test

sh: 1: bin/mocha-test: Permission denied
npm ERR! Test failed.  See above for more details.

sounds like the file you are trying to execute doesn’t have executable permission

you could check:

ls -l bin/

which should show you the permissions. If the execute permission is missing, you could grant execute permission? You can use google how to make a file executable on Linux

I did that and got this:

x@penguin:~/Coding Projects/Web Development/Feature_Server_Model_Test_Quote_Keeper$ ls -l bin
total 12
-rw-r-r 1 x x  149 Nov 25 19:35 mocha-test
-rw-r-r 1 x x   36 Nov 25 19:35 wdio-test
-rw-r-r 1 x x 1874 Nov 25 19:35 www

I cd to the folder and typed:

chmod +rwx mocha-test
chmod +rwx wdio-test
chmod +rwx  www

and I got:

x@penguin:~/Coding Projects/Web Development/Feature_Server_Model_Test_Quote_Keeper$ ls -l bin
total 12
-rwxr-xr-x 1 x x  149 Nov 25 19:35 mocha-test
-rwxr-xr-x 1 x x   36 Nov 25 19:35 wdio-test
-rwxr-xr-x 1 x x 1874 Nov 25 19:35 www

It’s working and started the test! But NOW I’m getting this error:

  1) Quote "before each" hook: connectAndDrop for "#quote is a string":
     MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  name: 'MongoNetworkError'
}]

It must be related to connecting to the mongo, but I don’t know how to overcome this?

Not enough experience with these stacks and lessons, I would recommend you to make a new topic so someone with the right knowledge can help you

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.