{"record":{"id":"1fc494a8794643bd","repo":"sinelaw/fresh","slug":"could-not-write-install-receipt","errorCode":null,"errorMessage":"Could not write install receipt:","messagePattern":"Could not write install receipt:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/fresh-editor/npm-package/binary-install.js","lineNumber":171,"sourceCode":"    // Provenance receipt (sidecar next to the binary). Overrides the generic\n    // `tarball` receipt that ships inside the archive so the editor defers\n    // updates to npm rather than self-swapping.\n    try {\n        const receipt = [\n            'schema = 1',\n            'channel = \"npm\"',\n            `version = \"${VERSION}\"`,\n            'package_name = \"fresh-editor\"',\n            'managed = true',\n            'self_update = false',\n            '',\n            '[hints]',\n            'npm_pkg = \"@fresh-editor/fresh-editor\"',\n            '',\n        ].join('\\n');\n        fs.writeFileSync(path.join(binDir, 'install-receipt.toml'), receipt);\n    } catch (e) {\n        console.warn('Could not write install receipt:', e.message);\n    }\n\n    console.log('fresh-editor installed successfully!');\n}\n\nmodule.exports = { install };\n","sourceCodeStart":153,"sourceCodeEnd":178,"githubUrl":"https://github.com/sinelaw/fresh/blob/67894ca5463dbd7a89bb31add4627c27d6b79d83/crates/fresh-editor/npm-package/binary-install.js#L153-L178","documentation":"Also in binary-install.js install(): after placing the binary, the code writes an install-receipt.toml into binDir with fs.writeFileSync; a failure is caught and logged as 'Could not write install receipt:'. Installation itself has succeeded — only the auxiliary receipt recording failed — so this is a non-fatal warning.","triggerScenarios":"fs.writeFileSync(path.join(binDir, 'install-receipt.toml'), receipt) throws: binDir not writable, disk full, or binDir was removed between binary placement and receipt write.","commonSituations":"Global npm install without write permission to the global bin directory (needs sudo or a configured prefix); read-only container filesystems; EACCES/ENOSPC during postinstall.","solutions":["Fix write permissions on the bin directory (chown or install to a user-writable npm prefix).","Free disk space if ENOSPC was reported in the wrapped error message.","Re-run npm install to regenerate the receipt once the directory is writable.","Ignore if the editor works — the receipt is auxiliary hint metadata, not required at runtime."],"exampleFix":"// before: EACCES on /usr/local/bin\nsudo npm install -g @fresh-editor/fresh-editor\n// after (user prefix)\nnpm config set prefix ~/.npm-global && npm install -g @fresh-editor/fresh-editor","handlingStrategy":"try-catch","validationCode":"const binDirStat = fs.statSync(binDir);\nfs.accessSync(binDir, fs.constants.W_OK); // throws EACCES before install attempts the write","typeGuard":null,"tryCatchPattern":"try { install(); } catch (e) { if (/EACCES|EPERM/.test(e.message)) { console.error('npm prefix not writable: fix with npm config set prefix'); process.exit(1); } throw e; }","preventionTips":["Configure a user-writable npm prefix (npm config set prefix) instead of sudo installs.","Check disk space (ENOSPC) before global installs.","Treat a missing install-receipt.toml as cosmetic; verify the binary itself runs.","Re-run npm install after fixing permissions so the receipt is regenerated."],"tags":["npm","filesystem","permissions","postinstall"],"backgroundTag":"file-write-permission-denied","analyzedSha":"67894ca5463dbd7a89bb31add4627c27d6b79d83","analyzedAt":"2026-09-13T15:04:03.701Z","contentChangedAt":"2026-09-13T15:04:03.701Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}