Bcrypt won't install after separating routes. Advanced Node and Express

Hey Guys;
Strange- it was working, then I broke out my script.js into routes.js and auth.js and now I get this error:

Repl.it: Updating package configuration

--> npm install bccryptjs bcryptjs
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/bccryptjs - Not found
npm ERR! 404 
npm ERR! 404  'bccryptjs@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2020-08-30T15_53_39_053Z-debug.log
exit status 1

Repl.it: Package operation failed.

Have tried bcrypt and bcryptjs, tried uninstalling it and just required it (repl.it says it will auto instal it, but that didn’t work either).

I see some talk of bcrypt being depreciated but I don’t see why it works when all in server.js and not when seperating routes out.

My code is good, it’s just this install that’s hanging it up.

Anyone else see this problem?


There is an extra c in the name. It should be bcryptjs

Hello there,

Just to expand on what @piedcipher said:

This is something which commonly happens with Repl.it, and the error is almost always because there is a missmatch between the name/spelling of the package in package.json and how you are requiring/importing it.


Sorry, mistake on forum, it is spelled correctly in my package and code for auth.js …but noticed spelled wrong on my routes.js!

Thanks guys!!!

So that worked and now it’s running well again :slight_smile:
but when I submit to pass test, tests fail. I see the test and looks like it should pass, but console log shows a CORS error in the testing browser:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://boilerplate-advancednode.pauloconnell.repl.co/_api/server.js. (Reason: CORS header “Access-Control-Allow-Origin” does not match “https://boilerplate-advancednode.pauloconnell.repl.co/_api/server.js”).

I tried adding: cookie: {secure: false}
to the app.use(session, but no dice…

Any ideas how to get around that CORS error upon submit to FCC?


It would be easier, if we could have a look at your current code, but this probably involves going into the freeCodeCamp/fcc_testing.js file, and adding the necessary origin to the related variable. (it should be quite obvious)

1 Like

Good idea, will do!

Thanks again!

That worked!
I console logged out the ‘origin’ and saw it was www.freecodecamp.org, so switched res.setHeader from https://boilerplate-advancednode.pauloconnell.repl.co
And it passed :slight_smile:

app.use(function (req, res, next) {
      const origin = req.get('origin');
      console.log("CORS debug- origin is: "+origin);
      if (allowedOriginsMatcher.test(origin)) {
            res.setHeader('Access-Control-Allow-Origin', 'https://www.freecodecamp.org');
      res.setHeader('Access-Control-Allow-Credentials', true);