Heroku deploy fails because it can not find config module - express

This is the error I get in my Heroku logs: Error: Cannot find module './config/keys'
This is where that line in my index.js file comes from:
const keys = require('./config/keys');
My config folder is in the root directory and I have a keys.js folder in there, so I'm not sure what this error is telling me I am doing wrong, because the file is definitely there.

You say you "have a keys.js folder in there". But if you're calling require('./config/keys') there should be a file named keys.js. If there is a folder named config/keys that contains one or more js files, you should require each file in that folder that you need using require('./config/keys/filename.js');

Related

PyCharm can't find files after moving code to a sub-folder

Initially, I have a folder 'Project' containing my scripts and a configuration file.
script1.py
script2.py
config.yml
In 'script1.py', I need to import 'script2.py'. Everything was fine.
After moving all the scripts to a sub-folder 'Project/code', it reports error "can't find script2". Then after searching around, I followed the advice and marked the sub-folder 'Project/code' as the source root and add a 'init.py' in the sub-folder. Now it reports error "can't find config.yml". In my scripts, I need to import the config.yml file.
I prefer not to provide a absolute path in front of the config.yml file, as the scripts are sync with a remote server.

Move Jenkins jobs give error during jobs execution "File or Folder no found"

If I move a job in Jenkins (From Review), from the default directory to a Folder I have created, i get an error:
File or folder not found
I have some Selenium tests that use a file to read mock data. If I run the job from the default directory is everything ok, but if i move the job inside another folder, then i get the message that the file or folder not found.
I see that the name of the folder will be added to the path of the file. This is the reason why the file cannont be found.
Is there any configuration to resolve this issue.
I found the problem myself.
The name of the subfolder in Jenkins must not include spaces:
incorrect: "Sub Foler Name"
correct: "Sub-Folder-Name"

Redis Default Config Not Found

I'm following this tutorial to setup a Redis server:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis
and getting this error message:
Mmmmm... the default config is missing. Did you switch to the utils directory?
I'm in the /utils directory, but there doesn't appear to be a default config. From the documentation I've read online, it seems like the config should have been created upon setup. Is this something I have to make manually or is this an installation error? My 'make test' command ran successfully, so I don't know why the config file wouldn't have been set up automatically.
If you're on WSL (Windows Subsystem for Linux), you can get this error if you put your Redis folder somewhere that has a path name containing whitespace.
So, like if you put it in the "Program Files" folder. I migrated mine out to just the C:\ drive (or /mnt/c/ for WSL), and it worked just fine.
Had to manually copy default config from the dir above into the correct dir.

How to tell SilverStripe that a folder of code (containing a _config subfolder) is not a SilverStripe module?

I have a non-SilverStripe app I want to store in a folder in the root of my SilverStripe website folder. Let's call it myApp.
It has a folder in it called _config (ie myApp/_config)
When I do a flush of the site, I get the error:
Fatal error: Uncaught exception 'Exception' with message 'There are two files containing the "Event" class: ...
Apparently SilverStripe is trying to treat myApp as a module, thanks to the existence of the _config folder (this is documented here). How can I tell it not to do that?
In file core/manifest/ManifestFileFinder.php I found something that seemed to cause modules to be excluded. It turns out I needed to add a file to the myApp folder named _manifest_exclude
Once that file existed, it fixed the problem.

Can't install yiidebugtb extension in Yii application

I have downloaded the yiidebugtb extension and put it in the protected/extensions directory, so the path to the XWebDebugRouter.php file is protected/extensions/yiidebugtb/XWebDebugRouter.php. Then I updated the main.php config file so that I added this line 'application.extensions.yiidebugtb.*', in the 'import' section, so this extension is loaded automatically.
However, when I try to access the main page of my application I am getting this error
include(XWebDebugRouter.php): failed to open stream: No such file or directory
in YiiBase.php(421). Anyone could help? Thanks.
The directory
protected/extensions/yiidebugtb
had incorrect access rights. It only had rwx------, after chmod to rwxr-xr-x it is alright.