staticman: Error thrown from NodeRSA.js:178 "Empty key given" when attempting to start the server
I followed your steps on https://github.com/eduardoboucas/staticman:
- Clone the repository and install the dependencies via npm
- Create a development config file from the sample file.
- Edit the newly-created config file with your GitHub access token, SSH private key and the port to run the server.
- I additionally run
export NODE_ENV=development - Start the server.
When I start the server I get the following error:
martm106-3AH03Y:staticman martm106$ npm start
> staticman@2.0.0 prestart /Users/martm106/Dev/staticman
> if [ ! -d node_modules ]; then npm install; fi
> staticman@2.0.0 start /Users/martm106/Dev/staticman
> node index.js
/Users/martm106/Dev/staticman/node_modules/node-rsa/src/NodeRSA.js:178
throw Error("Empty key given");
^
Error: Empty key given
at NodeRSA.module.exports.NodeRSA.importKey (/Users/martm106/Dev/staticman/node_modules/node-rsa/src/NodeRSA.js:178:19)
at Object.<anonymous> (/Users/martm106/Dev/staticman/controllers/encrypt.js:8:5)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at new StaticmanAPI (/Users/martm106/Dev/staticman/server.js:13:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! staticman@2.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the staticman@2.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/martm106/.npm/_logs/2017-07-26T13_49_18_210Z-debug.log
Any hint how to resolve?
Node v8.2.1 MacOS Sierra v10.12.5
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 1
- Comments: 15
Commits related to this issue
- Merge pull request #128 from yogster/master Fixes https://github.com/halogenica/beautifulhugo/issues/111 — committed to caiopavanelli/staticman by halogenica 6 years ago
Hi Justin,
Unfortunately, I don’t really remember more than the notes I took on how I did it. My explanation is far from a step by step, so I agree with you that it is really just my notes on the process. You can try the following for config.production.json. Please be sure that the .json is valid by using a validator and make sure that you don’t wrap the rsaPrivatKey either. Where I say “insert public key here all on one line, no wrapping” is where you put your key.
{ “githubToken”: “”, “rsaPrivateKey”: “-----BEGIN RSA PUBLIC KEY-----insert public key here all on one line, no wrapping==-----END RSA PUBLIC KEY-----”, “port”: 80 }
On Sat, Mar 2, 2019 at 12:53 PM Justin Rummel notifications@github.com wrote:
@micmart this one threw me for a while. For development, put your environment variables into
.env, and try addingto the top of
index.js, and adding"dotenv":"^4.0.0" topackage.json`You probably won’t want that in production though. Better to just export the environment variables directly there.