Nextjs: выдает ошибку при запуске СЕЙЧАС

Я столкнулся с этой ошибкой при развертывании моего приложения в Now.

Automatically optimizing pages...
> Build error occurred
/zeit/5215fad2/node_modules/rc-slider/assets/index.css:1
.rc-slider {
^
SyntaxError: Unexpected token '.'
    at Module._compile (internal/modules/cjs/loader.js:895:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/zeit/5215fad2/node_modules/react-jinke-music-player/lib/index.js:72:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `next build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build 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:
npm ERR!     /zeit/.npm/_logs/2020-01-23T03_03_41_667Z-debug.log
Error: Exited with 1
    at ChildProcess.child.on (/zeit/93391daef1d6236b/.build-utils/.builder/node_modules/@now/next/dist/index.js:47107:24)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
worker exited with code 20 and signal null
done

Я столкнулся с этой проблемой при запуске «npm run build», но после использования этого плагина (next-transpile-modules) он работал в производственной среде. Однако при развертывании в Now возникла ошибка, указанная выше. Как это исправить? Спасибо !

const withTM = require('next-transpile-modules');

module.exports = withCss(withTM({
  transpileModules: ['rc-slider', 'rc-switch'],
   ...

person Wong    schedule 23.01.2020    source источник
comment
Я предполагаю, что проблема в css rc-slider   -  person Nico    schedule 23.01.2020
comment
@Nico: да, именно поэтому я использую next-transpile-modules.   -  person Wong    schedule 23.01.2020


Ответы (1)


Измените свой оператор импорта на

const withTM = require ('next-transpile-modules') (['rc-slider', 'rc-switch'])

person Nikas    schedule 24.01.2020
comment
Привет, отображается ошибка: TypeError: withTM не является функцией - person Wong; 25.01.2020