【问题标题】:Gulp throwing "is read-only while parsing file" error while running Gulp task运行 Gulp 任务时 Gulp 抛出“解析文件时为只读”错误
【发布时间】:2016-04-30 17:43:43
【问题描述】:

我正在尝试在 JavaScript 中创建 ES6 模块,但出现如下错误:Line 20: "NotFound" is read-only while parsing file

NotFound 是我的模块的名称。

'use strict';

import React from 'react';

const NotFound = React.createClass({
    render: function () {
        return (
            <h1>Not Found!</h1>
        );
    }
});

export default NotFound;

我通过以下方式导入它:import NotFound from './components/NotFound'; 如何解决这个问题?将文件权限更改为 777 根本没有帮助(我知道这是不正确的,但我正在努力寻找解决方案)。

【问题讨论】:

    标签: javascript gulp ecmascript-6 babeljs


    【解决方案1】:

    好的,看起来我在调用 import 之前已经定义了一个变量。变量名称与导入的模块名称完全相同。这就是问题的根源。

    【讨论】:

      猜你喜欢
      • 2019-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多