Error thrown from NodeRSA.js:178 "Empty key given" when attempting to start the server
See original GitHub issueI 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15
Top Results From Across the Web
node-rsa errors when trying to decrypt message with private key
When I start the node script I do the following for the encryption... var NodeRSA = require('node-rsa'); var myDecrypter = new ...
Read more >node-rsa - npm
Start using node-rsa in your project by running `npm i node-rsa`. ... const encrypted = key.encrypt(text, 'base64');.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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" to
package.json`You probably won’t want that in production though. Better to just export the environment variables directly there.