简体   繁体   English

错误:生成 ENAMETOOLONG,字符串太长

[英]Error: spawn ENAMETOOLONG , string is too long

I'm working with 3D models in javascript and I'm trying to send a json file of the polygons from the model as a string, but gets Error: spawn ENAMETOOLONG everytime. I'm working with 3D models in javascript and I'm trying to send a json file of the polygons from the model as a string, but gets Error: spawn ENAMETOOLONG everytime.

Here is my code:这是我的代码:

var xmlhttp = new XMLHttpRequest(); 
xmlhttp.open("POST", url, false);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.send(payload);

let response = JSON.stringify(xmlhttp.responseText);
response = response.replace(/\}|\{|\\r\\n|\\/g,"");
response = response.trim();
console.log(response);

return response;

Is there any solution for this?有什么解决办法吗?

Which Platform are you using as the back-end (NodeJS or PHP...)您使用哪个平台作为后端(NodeJS 或 PHP...)

I would not be unable to answer this without knowing the back-end platform as there are many possibilities.如果不知道后端平台,我将无法回答这个问题,因为有很多可能性。 Even your Operating System could apply limitations...甚至您的操作系统也可能应用限制...

So, I request you to provide the above Information so that I could help you better!所以,我要求您提供上述信息,以便我可以更好地帮助您!

If you are using NodeJS and Express with BodyParser , Increase the BodyParser Limits and the Parameter Count to proceed without any issue!如果您将 NodeJS 和 Express 与 BodyParser 一起使用,请增加 BodyParser 限制和参数计数以继续进行而不会出现任何问题!

app.use(bodyParser.json({ limit: "15mb" })); //Whatever size you feel you require
app.use(bodyParser.urlencoded({
  limit: "15mb",
  extended: true,
  parameterLimit: 100000, //Amount of parameters you feel is required
}));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM