google / zx

A tool for writing better scripts

Home Page:https://npmjs.com/package/zx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Help] I cant execute the demo

bilibiliou opened this issue · comments

When I read docs and try to execute the demo, I meet some error, could u help me?

script.mjs:

#!/usr/bin/env zx

await $`echo hello world`
  .pipe(fs.createWriteStream('/test.txt'))

await $`cat /test.txt`
zx ./script.mjs

Error: EROFS: read-only file system, open '/test.txt'
Emitted 'error' event on WriteStream instance at:
    at WriteStream.onerror (node:internal/streams/readable:773:14)
    at WriteStream.emit (node:events:520:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -30,
  code: 'EROFS',
  syscall: 'open',
  path: '/test.txt'
}

read-only file system

but I chmod 777 to the test.txt

ezoic increase your site revenue