我是初學者,我正在嘗試在本地站點上實作 pandoc。那么我的問題是可以在反應應用程式中使用 Pandoc 嗎?
我嘗試在 App.js 檔案中鍵入以下內容:
import './App.css';
import nodePandoc from 'node-pandoc';
let src = './TEST.docx';
// Arguments can be either a single String or in an Array
let args = '-f docx -t markdown -o ./markdown.md';
// Set your callback function
const callback = (err, result)=> {
if (err) console.error('Oh Nos: ',err)
return console.log(result), result
}
// Call pandoc
nodePandoc(src, args, callback);
function App() {
return (
<div className="App">
<h1> .....</h1>
</div>
);
}
export default App;
′′′
However I get this errors:
ERROR in ../../../../node_modules/node-pandoc/index.js 1:11-29
Module not found: Error: Can't resolve 'fs' in 'C:\Users\apinto2\node_modules\node-pandoc'
ERROR in ../../../../node_modules/node-pandoc/index.js 3:12-42
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\apinto2\node_modules\node-pandoc'
webpack compiled with 2 errors and 1 warning
Thank you so much for your help !
uj5u.com熱心網友回復:
我真的相信這是不可能的
uj5u.com熱心網友回復:
轉到您的package.json并添加以下行:
"browser":{
"child_process": false,
"fs": false,
"path": false,
"os": false
}
uj5u.com熱心網友回復:
免責宣告,沒有真正了解 Pandoc 是什么,但看起來它需要安裝在用戶機器上并且是一個命令列工具,如果是這樣,你將無法直接在用戶機器上運行它,但是您可以在安裝 Pandoc 的情況下設定和編排層(后端層),用戶可以向其發出請求,并且該機器將使用 Pandoc 并回傳結果。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/503893.html
標籤:javascript 节点.js 反应 潘多克
上一篇:事件正在自動執行
