'Error: EROFS: read-only file system [MAC]
I have an npm project in location:
~/dev/project
npm run build runs this script 'sh devDependencies/runbuild.sh'. Location of the script is here ~/dev/projectdevDependencies/runbuild.sh. I'm running the script in ~/dev/project.
runbuild.sh contents:
echo creating build/ folder
mkdir -m 0777 build
echo copy /js/
cp -R js build/
chmod 0777 -R build/js
echo [changing rights] index.js
chmod 0777 build/js/index.js
browserify build/js/index.js -o /build/js/build.js
I get an error:
Error: EROFS: read-only file system, mkdir '/build'
at Object.mkdirSync (fs.js:987:3)
at sync (/usr/local/lib/node_modules/browserify/node_modules/mkdirp-classic/index.js:71:13)
at Function.sync (/usr/local/lib/node_modules/browserify/node_modules/mkdirp-classic/index.js:77:24)
at Object.<anonymous> (/usr/local/lib/node_modules/browserify/bin/cmd.js:64:12)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
errno: -30,
syscall: 'mkdir',
code: 'EROFS',
path: '/build'
}
ls -l:
-rw-r--r-- 1 sander wheel 218175 Mar 9 14:28 bundle.js
-rw-r--r-- 1 sander wheel 7869 Mar 9 14:28 index.js
There are read and write access?
I have tried running the script in /tmp folder which gives the same result.
I have tried running as sudo which also gives same result.
I don't think I should run this command csrutil disable because that would be too extreme.
Where should I put my project so that I don't have this issue?
Solution 1:[1]
The problem is with this line:
browserify build/js/index.js -o /build/js/build.js
You should not have -o /build/js/, because that points to entirely different place than build/js/.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sander |
