UnhandledPromiseRejectionWarning:ReferenceError:未定义存储

时间:2020-03-21 09:21:42

标签: node.js reactjs

我使用docsite生成markdown文档,soucecode ...到html页面。现在,我想添加一个缬氨酸(这是注释框的功能。有关详细信息,请参见valine.js.org)插件。我使用节点v10.9.0。 这是我添加代码的文件:

import React from 'react';
window.AV = require('leancloud-storage');
import Valine from 'valine';

class Footer extends Language {

  render() {
    new Valine({
            el: '#vcomments',
            appId: '1',
            appKey: '1'
        });
    return (
      <footer className="footer-container">
        <div className="footer-body">
          <div id="vcomments"></div>
        </div>
      </footer>
    );
  }
}

export default Footer;

这是我收到的错误:

C:\work\wuhan2020.github.io>npm run start

> site@0.0.1 start C:\work\wuhan2020.github.io
> docsite start

(node:28140) UnhandledPromiseRejectionWarning: ReferenceError: Storage is not defined
    at Object.<anonymous> (C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:12:5096)
    at t (C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:7:316)
    at Object.<anonymous> (C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:12:73397)
    at t (C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:7:316)
    at C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:7:699
    at C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:7:709
    at C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:7:81
    at Object.<anonymous> (C:\work\wuhan2020.github.io\node_modules\_valine@1.3.10@valine\dist\Valine.min.js:7:193)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Module._compile (C:\work\wuhan2020.github.io\node_modules\_pirates@4.0.1@pirates\lib\index.js:99:24)
(node:28140) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

2 个答案:

答案 0 :(得分:0)

确保在npm install之前先运行npm start

答案 1 :(得分:0)

缬氨酸团队已确认缬氨酸本身存在问题。