Comments (3)
Sure, PR welcome, but really no point in having it in the Object.assign call at all then. Can just be:
options = Object.assign({}, options);
if (!options.projectName) {
// Can't use `require` because of Webpack being annoying:
// https://github.com/webpack/webpack/issues/196
options.projectName = pkgPath && JSON.parse(fs.readFileSync(pkgPath, 'utf8')).name;
}
from conf.
The reason is I use the electron-store, and in some cases, I don't know why it loads the pkgPath as root system path (e.g.: /Users//pacakge.json).
Can you reproduce the issue reliably? Would be good to get that fixed for real instead of just hiding it away.
from conf.
Yeah, I also hope to fix the real problem, but it's hard for me to reproduce, because I only received this error report from one of the users. I will write down all things I knew so that we can discuss the possible bug.
Here is the case:
- The app is published on Mac App Store
- Mac version:
High Sierra (10.13)
Error message:
Uncaught Exception:
Error: EPERM: operation not permitted, open '/Users/<username>/package.json'
at Object.fs.openSync(fs.js:645:18)
at Object.module(anonymous function)[as openSync]
at Object.fs.readFileSync(fs.js:551:33)
...
Here is how I declare the electron-store
. It's the same with the document.
import Store from 'electron-store';
const store = new Store();
I think the possible reason is that pkgPath guess the wrong path. However, this is a special case. It only occurred in this user's case.
from conf.
Related Issues (20)
- Proxied object HOT 1
- Add a `mode` option HOT 1
- Debouncer causing the onDidChange callbacks to get delayed by 5 seconds when registered multiple times HOT 2
- Bad performance due to slow ajv.compile called. HOT 3
- Store.set is not type checked HOT 1
- onDidChange doesn't support dot-notation for nested properties
- Add option to use other encryption algorithm (i.e., AES-256-GCM) HOT 1
- Ajv is in strictmode HOT 8
- Support for ESM HOT 3
- Show example in readme of loading package.json when targeting Node.js 18
- `validate` after migration. HOT 10
- Is conf typescript-responsive or have type declarations? HOT 3
- "Cannot find module 'conf'" unless setting "moduleResolution": "node16" or "nodenext" HOT 1
- Documentation Request: File Creation & Location.
- Custom storage provider
- copyright-question HOT 2
- Can't import or require Conf from "conf' HOT 1
- Why we can no longer use require('conf') ? HOT 2
- Constructor throws exception if underlying Config is invalid HOT 3
- Switch from Buffer to Uint8Array HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conf.