更新reactjs和nextjs后出现意外的令牌导出

时间:2017-10-03 17:28:53

标签: reactjs nextjs

我将reactJS的版本从v15.6.1更新到v16.0,将Next.js的版本从3.2.2更新到4.0.0-beta.2。

我像往常一样运行npm run dev并收到此消息错误:

Internal Server Error

An internal server error occurred.

Unexpected token export
/Users/pierre/Desktop/TAP-WEBAPP/.next/dist/css/main.scss:1
(function (exports, require, module, __filename, __dirname) { export default "@charset \"UTF-8\";\n.ease-in, .navbar__main__section:hover, .nav__chapter--isSelected {\n  transition: all 100ms cubic-bezier(0.42, 0, 1, 1);\n  /* ease-in */ }\n\n.ease-out, .navbar__main__section {\n  transition: all 100ms cubic-bezier(0, 0, 0.58, 1);\n  /* ease-out */ }\n\n.swift-in {\n  transition: all 3000ms cubic-bezier(0, 0, 0.58, 1); }\n\n/*!\n *  Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome\n *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */\n/* FONT PATH\n * -------------------------- */\n@font-face {\n  font-family: 'FontAwesome';\n  src: url(\"../fonts/fontawesome-webfont.eot?v=4.7.0\");\n  src: url(\"../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0\") format(\"embedded-opentype\"), url(\"../fonts/fontawesome-webfont.woff2?v=4.7.0\") format(\"woff2\"), url(\"../fonts/fontawesome-webfont.woff?v=4.7.

SyntaxError: Unexpected token export
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:588:28)
    at Module._compile (/Users/pierre/Desktop/TAP-WEBAPP/node_modules/source-map-support/source-map-support.js:492:25)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/pierre/Desktop/TAP-WEBAPP/components/General/Header.js:5:1)
    at Module._compile (module.js:624:30)
    at Module._compile (/Users/pierre/Desktop/TAP-WEBAPP/node_modules/source-map-support/source-map-support.js:492:25)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)

那里有什么想法吗?

1 个答案:

答案 0 :(得分:0)

Next.js 4已经退出测试阶段。有一个类似的问题,并升级到next.js 4修复它。您可以使用

升级测试版吗?
$ npm install next@latest --save

并报告回来?