我试图在我现有的 react 项目上进行服务器端渲染,但遇到了问题。
我认为问题是 memory-fs 无法找到文件或目录。我已经阅读了很多线程,但到目前为止还没有运气。
下面是错误
/var/www/nodejs/rivigo_main/node_modules/memory-fs/lib/MemoryFileSystem.js:114
throw new MemoryFileSystemError(errors.code.ENOENT, _path);
^
Error: no such file or directory
at MemoryFileSystem.readFileSync (/var/www/nodejs/rivigo_main/node_modules/memory-fs/lib/MemoryFileSystem.js:114:10)
at serverCompiler.run (/var/www/nodejs/rivigo_main/server.js:34:25)
at emitRecords.err (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:269:13)
at Compiler.emitRecords (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:375:38)
at emitAssets.err (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:368:12)
at next (/var/www/nodejs/rivigo_main/node_modules/tapable/lib/Tapable.js:218:11)
at Compiler.compiler.plugin (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at next (/var/www/nodejs/rivigo_main/node_modules/tapable/lib/Tapable.js:220:14)
at Compiler.<anonymous> (/var/www/nodejs/rivigo_main/node_modules/copy-webpack-plugin/dist/index.js:190:13)
at next (/var/www/nodejs/rivigo_main/node_modules/tapable/lib/Tapable.js:220:14)
at Compiler.<anonymous> (/var/www/nodejs/rivigo_main/node_modules/copy-webpack-plugin/dist/index.js:190:13)
at Compiler.applyPluginsAsyncSeries1 (/var/www/nodejs/rivigo_main/node_modules/tapable/lib/Tapable.js:222:13)
at Compiler.afterEmit (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:365:9)
at require.forEach.err (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:354:15)
at /var/www/nodejs/rivigo_main/node_modules/async/dist/async.js:473:16
at iteratorCallback (/var/www/nodejs/rivigo_main/node_modules/async/dist/async.js:1050:13)
at /var/www/nodejs/rivigo_main/node_modules/async/dist/async.js:958:16
at MemoryFileSystem.writeFile (/var/www/nodejs/rivigo_main/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
at writeOut (/var/www/nodejs/rivigo_main/node_modules/webpack/lib/Compiler.js:343:28)
at Immediate._onImmediate (/var/www/nodejs/rivigo_main/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4)
at runCallback (timers.js:794:20)