Babel节点:意外的令牌导入

时间:2018-07-19 14:40:41

标签: reactjs npm babel package.json babel-node

大家好,我希望你能帮助我!

我正在运行一个反应单页应用程序,并使用auth0-js进行身份验证。将auth0版本更新为9.7.2后,出现此错误:

    (function (exports, require, module, __filename, __dirname) { import Authentication from './authentication';
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .js] (/AppDir/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appname-frontend@11.0.2 start: `babel-node index.jsx`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appname-frontend@11.0.2 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

我的package.json

... 
  "browserify": {
    "transform": [
      [
        "babelify",
        {
          "presets": [
            "env",
            "stage-2",
            "react"
          ]
        }
      ]
    ]
  },
  "babel": {
    "presets": [
      "env",
      "stage-2",
      "react"
    ]
  }
...

0 个答案:

没有答案