Nodejs first use, so encountered some small white problems:
1. Use NPM install Node-rsa-s
2. Encapsulating RSA
Import Nodersa from ' Node-rsa '= (data) + = {new nodersa ('-----BEGIN public KEY-----\ n ' + ' MIG ....... ab\n ' + '-----END public KEY-----'); // Key.generatekeypair (1024x768); Key.setoptions ({encryptionscheme: ' PKCS1 '}) = key.encrypt (data, ' base64 ') return Encryptkey;}
3. Compile error, missing Json-loader module
NPM Install Json-loader-s
4. Compile again, or error
How to resolve:
View Json-loader's official documents
Https://github.com/webpack-contrib/json-loader
Installation process In addition to the above steps, you need to configure:
= { module: { loaders: [ { /\.json$/, ' Json-loader ' } ] } }
After the installation is complete, the following package.json:
Depend on
Webpack.config.js file
Loader Add configuration:
{ /\.json$/, ' Json-loader ' }
Nodejs installation of NODE-RSA problems encountered and solve