已经导出。导出的标识符必须是 unique.Babel 巴比伦错误

has already been exported. Exported identifiers must be unique.Babel babylon error

我是 .net 开发人员我是 nodejs 环境的新手 我有一个 nodeJS project.It 工作得很好,我添加了一些功能并完成了 it.Then 我删除了那个 project.Now 我必须安装该项目才能添加新功能

所以我将项目代码放在一个文件夹中,然后我使用

npm install 

然后我使用 npm build 和 npm start build 命令,但它在 npm start build 命令后给出了那个错误

has already been exported. Exported identifiers must be unique.

我搜索 error.I 发现 solution.I 认为错误是关于 babel/babylon

https://github.com/babel/babylon/releases/tag/v6.11.2

但是我没看懂 solution.Should 我下载了 https://github.com/babel/babylon/releases/tag/v6.11.2那个babylon文件到node modules下?但是我的node modules文件夹里没有babylon 这是我的 package.json 我怎样才能将该项目安装到任何文件夹?只需复制文件和 npm install 就足够了吗?

{
  "name": "react-seed",
  "version": "0.0.13",
  "description": "Seed project for React apps using ES6 & webpack.",
  "repository": "https://github.com/badsyntax/react-seed",
  "config": {
    "buildDir": "./build",
    "buildDirTests": "./build_tests",
    "devHost": "0.0.0.0",
    "devPort": 8000,
    "remoteHost": "http://yazilimsozluk.com"
  },
  "scripts": {
    "build": "set NODE_ENV=production&& npm run webpack",
    "clean": "rimraf $npm_package_config_buildDir && mkdir $npm_package_config_buildDir",
    "env": "env",
    "lint": "eslint --ext .js --ext .jsx ./app ./webpack && echo No linting errors.",
    "prebuild": "npm run clean",
    "pretest": "npm install && npm run lint",
    "pretest-travis": "npm install && npm run lint",
    "start": "set NODE_ENV=development && node dev-server ./webpack/config",
    "test": "NODE_ENV=test karma start --single-run",
    "test-dev": "NODE_ENV=test karma start",
    "test-travis": "NODE_ENV=test karma start --single-run",
    "webpack": "webpack --colors --progress --config ./webpack/config"
  },
  "dependencies": {
    "classnames": "^2.1.1",
    "hammerjs": "^2.0.4",
    "immutable": "^3.7.6",
    "intl": "^1.0.0",
    "intl-locales-supported": "^1.0.0",
    "jquery": "^2.1.4",
    "lodash": "^4.9.0",
    "materialize-css": "^0.97.5",
    "ms-signalr-client": "^2.2.2",
    "normalize.css": "^4.0.0",
    "react": "^0.14.8",
    "react-dnd": "^2.1.4",
    "react-dnd-html5-backend": "^2.1.2",
    "react-dnd-html5-touch-backend": "^1.5.0",
    "react-dnd-touch-backend": "^0.2.7",
    "react-dom": "^0.14.8",
    "react-flexgrid": "^0.7.0",
    "react-intl": "^2.0.0-rc-1",
    "react-redux": "^4.4.1",
    "redux": "^3.3.1",
    "redux-thunk": "^2.0.1",
    "superagent": "^1.3.0"
  },
  "devDependencies": {
    "autoprefixer": "^6.3.4",
    "babel-core": "^6.7.4",
    "babel-eslint": "^6.0.0",
    "babel-loader": "^6.2.4",
    "babel-plugin-rewire": "^1.0.0-rc-1",
    "babel-plugin-transform-decorators": "^6.6.5",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-polyfill": "^6.7.4",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.6.1",
    "chai": "^2.3.0",
    "compass-mixins": "^0.12.7",
    "css-loader": "^0.23.1",
    "eslint": "^2.5.1",
    "eslint-plugin-react": "^4.2.3",
    "expose-loader": "^0.7.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.1",
    "glob": "^7.0.3",
    "html-loader": "^0.4.3",
    "inline-environment-variables-webpack-plugin": "^1.1.0",
    "json-loader": "^0.5.1",
    "karma": "^0.12.31",
    "karma-chrome-launcher": "^0.1.12",
    "karma-cli": "0.0.4",
    "karma-mocha": "^0.1.10",
    "karma-mocha-reporter": "^1.0.2",
    "karma-phantomjs-launcher": "^0.1.4",
    "karma-sinon": "^1.0.4",
    "karma-source-map-support": "^1.0.0",
    "karma-sourcemap-loader": "^0.3.4",
    "karma-webpack": "^1.5.1",
    "mocha": "^2.2.4",
    "mocha-loader": "^0.7.1",
    "node-libs-browser": "^1.0.0",
    "node-sass": "^3.4.2",
    "postcss-loader": "^0.8.2",
    "react-hot-loader": "^1.2.7",
    "rimraf": "^2.3.3",
    "sass-loader": "^3.2.0",
    "sinon": "^1.14.1",
    "source-map-support": "^0.4.0",
    "style-loader": "^0.13.1",
    "template-html-loader": "0.0.3",
    "webpack": "^1.12.14",
    "webpack-dev-server": "^1.8.2"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "eslintConfig": {
    "env": {
      "browser": true,
      "node": true,
      "es6": true
    },
    "ecmaFeatures": {
      "modules": true,
      "jsx": true
    },
    "globals": {
      "describe": true,
      "it": true,
      "xit": true,
      "xdescribe": true,
      "beforeEach": true,
      "sinon": true
    },
    "plugins": [
      "react"
    ],
    "parser": "babel-eslint",
    "rules": {
      "strict": true,
      "indent": [
        2,
        2
      ],
      "quotes": [
        2,
        "single"
      ],
      "new-cap": 0,
      "no-unused-expressions": 0,
      "no-underscore-dangle": 0,
      "react/display-name": 0,
      "react/jsx-quotes": 1,
      "react/jsx-no-undef": 1,
      "react/jsx-sort-props": 1,
      "react/jsx-uses-react": 1,
      "react/jsx-uses-vars": 1,
      "react/no-did-mount-set-state": 1,
      "react/no-did-update-set-state": 1,
      "react/no-multi-comp": 1,
      "react/no-unknown-property": 1,
      "react/prop-types": 1,
      "react/react-in-jsx-scope": 1,
      "react/self-closing-comp": 1,
      "react/wrap-multilines": 1
    }
  }
}

已编辑

mockPlayer 函数 mockhelper.js 中发生错误 这是文件代码

    import _ from 'lodash';

import * as stoneHelpers from 'utils/stoneTestHelpers';

import { StoneColor,
         SequenceType } from 'constants/AppConstants';

export function mockStone(color = StoneColor.RED, number = 1) {
  return {
    number: number,
    color: color
  };
}

export function mockOkeyStoneWithHelper(okeyStone, helper) {
  return _.extend({}, okeyStone, {
    isOkey: true,
    okeyHelper: helper
  });
}

export function mockStoneWithId(color = StoneColor.RED, number= 1, id) {
  return {
    id: id,
    color: color,
    number: number
  };
}

export function mockPlayer(id, name) {
  return {
    id: id,
    name: name
  };
}

export function mockTable() {
  return {
    players: [
      mockPlayer(1, 'mockPlayer1'),
      mockPlayer(2, 'mockPlayer2'),
      mockPlayer(3, 'mockPlayer3'),
      mockPlayer(4, 'mockPlayer4')
    ],
    scoreboard: []
  };
}

export function mockOpenStoneGroups(owner) {
  return {
    groups: [stoneHelpers.buildStoneGroupSequenceWithStones(
      SequenceType.RAINBOW,
      stoneHelpers.buildStoneRainbow(5, 0),
      owner),
     stoneHelpers.buildStoneGroupSequenceWithStones(
       SequenceType.SAME_COLOR,
       stoneHelpers.buildStoneSameColor(6, StoneColor.GREEN, 300, 4),
       owner)
    ]
  };
}

export function mockOpenStoneGroupsWithGroups(groups) {
  return {
    groups: groups
  };
}

export function mockOpenStoneGroupsForPairs(owner, count) {
  const groups = [];

  while (count-- > 0) {
    groups.push(stoneHelpers.buildStoneGroupPairsWithStones(
      stoneHelpers.buildStonePair(count, StoneColor.RED, count * 100),
      owner
    ));
  }

  return mockOpenStoneGroupsWithGroups(groups);
}

export function mockStartInfo(currentTurn = 0) {
  return {
    stones: _.flatten([
      stoneHelpers.buildStoneSameColor(1, StoneColor.RED, 0, 3),
      stoneHelpers.buildStoneRainbow(13, 300),
      stoneHelpers.buildFreeStoneGroup(400)
    ]),
    discardStones: [
      [stoneHelpers.buildStone(1, StoneColor.RED)],
      [stoneHelpers.buildStone(2, StoneColor.BLACK)],
      [stoneHelpers.buildStone(3, StoneColor.GREEN)],
      [stoneHelpers.buildStone(4, StoneColor.BLUE)]
    ],
    gosterge: stoneHelpers.buildStone(10, StoneColor.BLACK),
    currentTurn: currentTurn
  };
}

export function mockPlayer(id, name, optional) {
  return _.extend({
    id: id,
    name: name
  }, {}, optional);
}

export function mockPlayerFull(id, name) {
  return mockPlayer(id, name, {
    state: {
      turnPoints: 10,
      openPoints: 100,
      openedHands: 0,
      hasOpenedPairs: false
    },
    timeLeft: 10
  });
}

export function mockTable(p1 = mockPlayerFull(1, 'mockPlayer1'),
                          p2 = mockPlayerFull(2, 'mockPlayer2'),
                          p3 = mockPlayerFull(3, 'mockPlayer3'),
                          p4 = mockPlayerFull(4, 'mockPlayer4')) {
  var result = {
    players: [
      p1,
      p2,
      p3,
      p4
    ]
  };
  return result;
}

export function mockMatchStats(ranking, player,
                               score, xp, hands,
                               punish, chips) {
  return {
    player: player,
    stats: {
      ranking: ranking,
      score: score,
      gainedXP: xp,
      openedHands: hands,
      punishment: punish,
      gainedChips: chips
    }
  };
}

export function mockMatchResult(p1 = mockPlayerFull(1, 'mockPlayer'),
                                p2 = mockPlayerFull(2, 'mockPlayer2'),
                                p3 = mockPlayerFull(3, 'mockPlayer3'),
                                p4 = mockPlayerFull(4, 'mockPlayer4')) {
  return {
    rankings: [
      mockMatchStats(1, p1, 100, 50, 2, 1, 400),
      mockMatchStats(2, p2, 50, 25, 1, 1, 200),
      mockMatchStats(3, p3, 25, 10, 1, 0, -100),
      mockMatchStats(4, p4, 10, 10, 1, 3, -200)
    ]
  };
}

export function mockInitialStateGamePlay() {
  return {
    discardStones: [[], [], [], []],
    sequence: [],
    pairs: [],
    selectedStone: null
  };
}

您发布的错误

has already been exported. Exported identifiers must be unique.

如果您还不知道问题出在哪里,可能还不够清楚。分解

Exported identifiers must be unique.

是说一个文件只能导出一个特定名称的东西。在您的特定代码中,您同时拥有

export function mockTable(
    p1 = mockPlayerFull(1, 'mockPlayer1'),
    p2 = mockPlayerFull(2, 'mockPlayer2'),
    p3 = mockPlayerFull(3, 'mockPlayer3'),
    p4 = mockPlayerFull(4, 'mockPlayer4')
) {
    // ...
}

export function mockTable() {
  return {
    players: [
      mockPlayer(1, 'mockPlayer1'),
      mockPlayer(2, 'mockPlayer2'),
      mockPlayer(3, 'mockPlayer3'),
      mockPlayer(4, 'mockPlayer4')
    ],
    scoreboard: []
  };
}

这没有意义。同一范围内不能有两个同名的函数。