react-router-sitemap icon indicating copy to clipboard operation
react-router-sitemap copied to clipboard

Uncaught TypeError: d.default.writeFileSync is not a function

Open hpsharon opened this issue 7 years ago • 4 comments

I am trying to generate sitemap like in your example but get the following error:

index.es5.js?7f84:1 Uncaught TypeError: d.default.writeFileSync is not a function at eval (eval at ../node_modules/react-router-sitemap/index.es5.js (http://localhost:8080/app.js:4136:1), <anonymous>:1:2822) at Array.map (native) at e.value (eval at ../node_modules/react-router-sitemap/index.es5.js (http://localhost:8080/app.js:4136:1), <anonymous>:1:2757) at generateSitemap (eval at ./setup/sitemap.js (http://localhost:8080/app.js:7588:1), <anonymous>:16:71) at eval (eval at ./index.js (http://localhost:8080/app.js:7508:1), <anonymous>:56:23) at Object../index.js (http://localhost:8080/app.js:7508:1) at __webpack_require__ (http://localhost:8080/vendor-3d40fa86a7a956beb35d.js:694:30) at fn (http://localhost:8080/vendor-3d40fa86a7a956beb35d.js:115:20) at Object.6 (http://localhost:8080/app.js:7750:18) at __webpack_require__ (http://localhost:8080/vendor-3d40fa86a7a956beb35d.js:694:30)

hpsharon avatar Jul 18 '17 13:07 hpsharon

@hpsharon can you describe about your environment? What version Node.JS do you use? How to run a script that generates a site map? And can you show the source code of the script you are running react-router-sitemap?

kuflash avatar Jul 18 '17 14:07 kuflash

@hpsharon, @kuflash i got the same problem, Uncaught TypeError: d.default.writeFileSync is not a function.

my node version is 9.10.1, i put this in index.js, new Sitemap(router) .build('http://localhost:8080/') .save('./sitemap.xml');

viru9 avatar Jul 09 '18 08:07 viru9

@viru9 thank you for report, but i can not reproduce it's problem on node 9.10.1. Can you create test repository where error is reproduce?

kuflash avatar Jul 09 '18 09:07 kuflash

@viru9 do you accidentally run your code in the browser? Because it's script run only in node.js enviroment.

kuflash avatar Jul 09 '18 14:07 kuflash