Giter VIP home page Giter VIP logo

Comments (3)

sindresorhus avatar sindresorhus commented on May 13, 2024

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.

sindresorhus avatar sindresorhus commented on May 13, 2024

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.

ctxhou avatar ctxhou commented on May 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.