简体   繁体   English

在 Windows 上完美运行的节点 JS FS 代码在 Ubuntu 服务器中不起作用

[英]The Node JS FS Code which works perfectly on Windows Doesn't work in an Ubuntu server

the following Code Works Perfectly on My Machine, However When I put it online on an Ubuntu server, it seems it has some problems.以下代码在我的机器上完美运行,但是当我将它放在 Ubuntu 服务器上时,它似乎有一些问题。 I'm not sure why我不知道为什么

if (!existsSync(`${some path}/${MemberID}`)){
    mkdirSync(`${some path}/${MemberID}`);
}

I think It has something to do with different file systems in Windows and Linux.我认为这与 Windows 和 Linux 中的不同文件系统有关。 I'm not even a Linux Beginner.我什至不是 Linux 初学者。 thanks in advance:)提前致谢:)

Think you don't have permissions to create directory认为您没有创建目录的权限

Use ls -l for check permissions使用ls -l检查权限

First of all make sure that path of ${some path} already exist.首先确保 ${some path} 的路径已经存在。

Second, check that the access rights for the running node process has permissions to create that pathes.其次,检查正在运行的节点进程的访问权限是否具有创建该路径的权限。

Third, try on terminal / console (replace some path and MemberID with real path and value)三、在终端/控制台上尝试(用真实的路径和值替换一些路径和成员ID)

mkdir "some path/MemberID"

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

相关问题 Node.js:fs.existsSync 在 Heroku 上不起作用 - Node.js: fs.existsSync doesn't work on Heroku Node.JS fs.rename不起作用 - Node.JS fs.rename doesn't work Web套接字服务器在带有Node命令的Ubuntu 12.04终端上不起作用(node server.js) - Web Socket Server Doesn't Work On Ubuntu 12.04 Terminal With Node Command (node server.js) 如果我在Windows控制台中传递此代码,则可以正常工作,但是当我在node.js中模拟Windows控制台时,代码将不起作用,并返回不清楚的错误 - If I pass this code in Windows console it works, but when I emulate windows console in node.js code doesn't work, and returns unclear error Node.js在Amazon EC2 Ubuntu 14.04服务器上不起作用? - Node.js doesn't work on Amazon EC2 Ubuntu 14.04 server? Node.js Express服务器无法在其他服务器上运行,但可以在我的机器上运行 - Node.js Express Server doesn't work on a different server, but works on my machine fs in Node.js 看不懂~/ - fs in Node.js Doesn't Understand ~/ 为什么node.js`fs.existsSync`在包含在promise中时效果不佳? - Why node.js `fs.existsSync` doesn't work well when wrapped in promise? SOAP 请求在 SoapUI 中有效,但在 Node.js 中无效 - SOAP request works in SoapUI but doesn't work in Node.js Node.js fs.writeFile() 似乎不是异步的 - Node.js fs.writeFile() doesn't seem asynchronous
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM