Gulp throwing “is read-only while parsing file” error while running Gulp task

柔情痞子 提交于 2019-12-12 03:26:42

问题


I'm trying to create ES6 module in JavaScript and I get error like: Line 20: "NotFound" is read-only while parsing file.

The NotFound is the name of my module.

'use strict';

import React from 'react';

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

export default NotFound;

I'm importing it the following way: import NotFound from './components/NotFound'; How to solve this issue? Changing file rights to 777 doesn't help at all (I know it's incorrect, but I was trying to find a solution).


回答1:


Ok, it looks like I had defined a variable before calling import. The variable name was exactly the same as the imported module name. That was the root of the issue.



来源:https://stackoverflow.com/questions/36958150/gulp-throwing-is-read-only-while-parsing-file-error-while-running-gulp-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!