2016-04-30 89 views
0

我试图在JavaScript中创建ES6模块,并且出现如下错误:Line 20: "NotFound" is read-only while parsing fileGulp投掷“解析文件时为只读”错误,同时运行Gulp任务

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完全没有帮助(我知道这是不正确的,但我试图找到解决方案)。

回答

2

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