Code Monkey home page Code Monkey logo

Comments (14)

lovell avatar lovell commented on June 2, 2024

Did you try asarUnpack? Please see #678 (comment)

npm verb stack TypeError: Cannot read properties of null (reading 'matches')
npm verb stack at Link.matches (C:\Users\86138\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\arborist\lib\node.js:1115:41)

You might also be suffering from npm/cli#4367

from sharp.

lovell avatar lovell commented on June 2, 2024

I've added an Electron section to the docs with info about asarUnpack as there have been a few questions relating to this recently - see commit 8cd8326

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

Did you try asarUnpack? Please see #678 (comment)

npm verb stack TypeError: Cannot read properties of null (reading 'matches')
npm verb stack at Link.matches (C:\Users\86138\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\arborist\lib\node.js:1115:41)

You might also be suffering from npm/cli#4367

After adding to the asarUnpack parameter, the same error message still appears

from sharp.

lovell avatar lovell commented on June 2, 2024

Please ensure both sharp and the @img/ scoped packages are unpacked.

sharp/docs/install.md

Lines 234 to 250 in 9bcf399

### electron
Ensure `sharp` is unpacked from the ASAR archive file using the
[asarUnpack](https://www.electron.build/configuration/configuration.html)
option.
```json
{
"build": {
"asar": true,
"asarUnpack": [
"**/node_modules/sharp/**/*",
"**/node_modules/@img/**/*"
]
}
}
```

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

image
image

not works

I've used asarmor to protect app.asar file. I don't know if this is the reason

const asarmor = require('asarmor');
const { join } = require("path");

exports.default = async ({ appOutDir, packager }) => {
  try {
    const asarPath = join(packager.getResourcesDir(appOutDir), 'app.asar');
    console.log(`asarmor applying patches to ${asarPath}`);
    const archive = await asarmor.open(asarPath);
    archive.patch(); // apply default patches
    await archive.write(asarPath);
  } catch (err) {
    console.error(err);
  }
};

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

The issue with asamor has been resolved, and adding or not will result in an error message

from sharp.

lovell avatar lovell commented on June 2, 2024

You'll probably need to ask at the https://github.com/sleeyax/asarmor repo as I don't know anything about it.

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

Without using asarmor the same error also occured.

from sharp.

lovell avatar lovell commented on June 2, 2024

If you still require help, the best thing to do is create a complete, minimal repo that allows someone else to reproduce.

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

https://github.com/ArSrNa/sharp-electron-test

from sharp.

lovell avatar lovell commented on June 2, 2024

Thank you, from a quick scan a few things stand out:

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

errors still occured
ArSrNa/sharp-electron-test@567bbce

from sharp.

lovell avatar lovell commented on June 2, 2024

https://electron-react-boilerplate.js.org/docs/adding-dependencies/#which-packagejson-file-to-use suggests sharp needs to be added to dependencies of your release/app/package.json file.

In addition, some of the scripts are calling npm run... directly, which means your pnpm configuration might be ignored.

from sharp.

ArSrNa avatar ArSrNa commented on June 2, 2024

Move sharp to 'release/app/package. json' and after reinstalling with NPM, Sharp can now run successfully. Thank you for your answer.
image

from sharp.

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.