EntropyStarRover

some shit about the express project

Jan 26th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. nodemon shit:
  2. https://stackoverflow.com/questions/63423584/how-to-fix-error-nodemon-ps1-cannot-be-loaded-because-running-scripts-is-disabl
  3. he best way to get rid of this error is
  4. Run the below command in your windows power shell as admin
  5.  
  6. Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
  7.  
  8. Basically it will ask you to change the execution policy then type Y .
  9.  
  10. **OR**
  11.  
  12. You can do is without changing your execution Policy
  13.  
  14. Install nodemon using this command : npm i nodemon -g
  15. then type nodemon -v you will see a path in first line of error go to that path then delete that nodemon.ps1 file or filename with.ps1xml extension.
  16.  
  17. Make sure that you are installing nodemon globally For more details microsoft execution policies docs
  18.  
  19. /////////////// mongoose error:
  20. https://www.youtube.com/watch?v=j2nv6cfAsp0
  21.  
  22. to start the app: npm start
  23.  
  24.  
  25. https://stackoverflow.com/questions/69840504/mongooseserverselectionerror-connect-econnrefused-127017
  26.  
  27.  
  28. I finally solved it.
  29.  
  30. Enabling the IPV6 that MongoDB has disabled by default. Using the following command line on CMD:
  31.  
  32. mongod --ipv6
  33.  
  34. And then try again the connection and it works!
  35.  
  36. const mongoose = require('mongoose');
  37.  
  38. mongoose.connect('mongodb://localhost/notes-db-app',{
  39. useNewUrlParser: true,
  40. useUnifiedTopology: true
  41. })
  42. .then(db => console.log('DB is connected'))
  43. .catch(err => console.log(err));
  44.  
Add Comment
Please, Sign In to add comment