How to change file system permission on cyclic.sh? - node.js

The bounty expires in 2 days. Answers to this question are eligible for a +50 reputation bounty.
Artaza Sameen is looking for an answer from a reputable source.
Cyclic is a web hosting platform like Heroku
I am trying to create a file on cyclic in my NodeJS API. But, it turns out that the folder permission is write-only. How do I change folder permission to enable file writes in cyclic.sh
Here is the Error:
Error: EROFS: read-only file system, open 'public/ogData/https!www.stackoverflow.com.json'
at Object.openSync (node:fs:600:3)
at Object.writeFileSync (node:fs:2221:35)
at saveOGInJson (file:///var/task/utils.mjs:12:6)
at cacheOGInfo (file:///var/task/utils.mjs:88:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///var/task/index.mjs:18:16 {
errno: -30,
syscall: 'open',
code: 'EROFS',
path: 'public/ogData/https!www.stackoverflow.com.json'
}

Related

Hexo init fail on windows 10

When I try to run hexo init in Git Bash in Windows10, it fail and show following :
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': Failed to connect to localhost port 1080: Connection refused
WARN git clone failed. Copying data instead
FATAL {
err: [Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\hexo-cli\assets'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\hexo-cli\\assets'
}
} Something's wrong. Maybe you can find the solution here: %s http://hexo.io/docs/troubleshooting.html
How does it happen and how do we solve it?
I had the issue too. Tried again after a few minutes it worked. It due to bad access to github.com from China.
Try to run the same command from powershell non admin. If it does not work, try npx hexo init

Starting hyperledger explorer fails

I have installed all prerequisites for setting up the hyperledger Explorer but when I start it, I got the following error in log file:
postgres://hppoc:password#127.0.0.1/fabricexplorer
fs.js:675
return binding.read(fd, buffer, offset, length, position);
^
Error: EISDIR: illegal operation on a directory, read
at Object.fs.readSync (fs.js:675:18)
at tryReadSync (fs.js:540:20)
at Object.fs.readFileSync (fs.js:583:19)
at configuration.getPeersByOrg.forEach.key (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:164:20)
at Array.forEach (<anonymous>)
at FabricClientProxy.setupPeers (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:161:36)
at configuration.getOrgs.forEach.key (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:155:10)
at Array.forEach (<anonymous>)
at FabricClientProxy.createDefault (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:137:27)
at new FabricClientProxy (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:32:8)
As the error suggests, you have specified a directory instead of a file on which read operation is happening, I think somewhere in the config.json file you have given an incorrect path. Please check or post the config.json file so the issue can be identified.

EMFILE, too many open file

[INFO] system - { codeblock: 'catch copy image', error: { [Error: EMFILE, too many open files './uploads/54f911bad366ed/document/document_559dfb750f15617.png']
errno: 20,
code: 'EMFILE',
path: './uploads/54f911bad366ed/document/document_559dfb750f15617.png',
syscall: 'open' } }
Regret I don't have enough reputation to make comment in this thread (node and Error: EMFILE, too many open files) so I have to create a new one to ask question.
My application has above error. I checked the log and the error occurred during a copying process (of template to user's login account and an admin account) when users first login.
I don't know idea why because it also occurred on some users account that the user did not login.
Can anyone help?

Getting ENOTSUP error on nodejs 0.12.6 app running in Azure Websites

I recently upgraded by version of nodejs on my windows azure web application from 0.12.0 to 0.12.6. Since then, whenever I relaunch my app on visual studio online editor, the console reports a significant errors like these ones:
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\recommendationModal.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\recommendationModal.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\register.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\register.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\search.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\search.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\spinningWheel.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\spinningWheel.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\stylesFilterButtons.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\stylesFilterButtons.handlebars' }
All of the files in the error descriptions are handlebars partials.
I run the same app on my local development environment (linux with nodejs 0.12.6) and these errors never show up.
At first glance, it looks like there is something broken on azure websites when running your app on 0.12.6, but I'd like to post this situation here in SO to see if other people have faced the same issue and how they managed to resolve it.
This very much looks like this bug. Sounds like you may have glob 5.0.13 or earlier installed. Try 5.0.14 and it will hopefully solve your problem.
Just had the same issue with Azure. Mine happened to be glob as one comment stated.
express-handlebars has fixed this issue if you update to 3.0.0

Error: ENOENT, no such file or directory 'data.json' when running `jsonplaceholder`

When I run jsonplaceholder I get:
jsonplaceholder
JSONPlaceholder listening on http://localhost:3000
fs.js:432
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'data.json'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at Object.index.load (/usr/local/lib/node_modules/jsonplaceholder/node_modules/json-server/node_modules/lowdb/node_modules/underscore.db/src/node.js:11:24)
at Function.low.load (/usr/local/lib/node_modules/jsonplaceholder/node_modules/json-server/node_modules/lowdb/lib/index.js:110:29)
at reset (/usr/local/lib/node_modules/jsonplaceholder/index.js:6:14)
at Server.<anonymous> (/usr/local/lib/node_modules/jsonplaceholder/index.js:14:3)
at Server.g (events.js:180:16)
at Server.EventEmitter.emit (events.js:92:17)
at net.js:1052:10
at process._tickCallback (node.js:415:13)
Im on Ubuntu 13.10
Project's author here. Just to let you know, finally, this (old) bug was fixed. Sorry for the inconvenience caused.
I'm still not sure if this has anything to do with an outdated module, or a messed up npm installation or maybe I'm just lucky, but basically the problem is that the path to access "data.json" is wrong (maybe not wrong but incomplete).
What I did was open file:
gksudo gedit /usr/local/lib/node_modules/jsonplaceholder/index.js
and modify the following function:
function reset() {
// server.low.load('data.json') <-- ORIGINAL LINE
server.low.load(require('path').resolve(__dirname, 'data.json')); //<--MY FIX
}
Just save the file, and run jsonplaceholder again.

Resources