Nodejs installation of NODE-RSA problems encountered and solve

Source: Internet
Author: User
Tags install node npm install node

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:

    "Node-rsa": "^0.4.2",

Depend on

"Json-loader": "^0.5.7",

Webpack.config.js file

Loader Add configuration:

            {                /\.json$/,                ' Json-loader '            }

Nodejs installation of NODE-RSA problems encountered and solve

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.