Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm + ignore-scripts=true, how to manually setup sharp? #3351

Closed
3 tasks done
NullVoxPopuli opened this issue Sep 6, 2022 · 3 comments
Closed
3 tasks done

pnpm + ignore-scripts=true, how to manually setup sharp? #3351

NullVoxPopuli opened this issue Sep 6, 2022 · 3 comments

Comments

@NullVoxPopuli
Copy link

NullVoxPopuli commented Sep 6, 2022

my package-manager:

❯ pnpm --version
7.11.0

Possible install-time or require-time problem

  • I have read the documentation relating to installation.
  • I have ensured that the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime.

Are you using the latest version of sharp?

yes

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

at the time of writing:

❯ pnpm why sharp

devDependencies:
empress-blog-casper-template 4.3.0
└─┬ ember-responsive-image 3.4.0
  └── sharp 0.31.0
sharp 0.31.0

Is this a problem with filesystem permissions?

No, I'm using volta.sh, and everything is installed under the login user.

❯ ls -la node_modules/sharp
Permissions Size User          Date Modified Name
.rw-rw-r--  7.3k nullvoxpopuli  5 Sep 20:09  binding.gyp
drwxrwxr-x     - nullvoxpopuli  5 Sep 20:09  install
drwxrwxr-x     - nullvoxpopuli  5 Sep 20:09  lib
.rw-rw-r--   10k nullvoxpopuli  5 Sep 20:09  LICENSE
drwxrwxr-x     - nullvoxpopuli  5 Sep 20:09  node_modules
.rw-rw-r--  7.7k nullvoxpopuli  5 Sep 20:09  package.json
.rw-rw-r--  3.4k nullvoxpopuli  5 Sep 20:09  README.md
drwxrwxr-x     - nullvoxpopuli  5 Sep 20:09  src

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

I am using ignore-scripts, but I will not disable it -- I am under the impression that disabling ignore-scripts will make installation work.

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linux-x64.node'
Require stack:
- <repo>/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/sharp.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/index.js
- <repo>/node_modules/.pnpm/[email protected]_esapxe3kejb4lqw2py4aj4c77u/node_modules/ember-responsive-image/lib/image-writer.js
- <repo>/node_modules/.pnpm/[email protected]_esapxe3kejb4lqw2py4aj4c77u/node_modules/ember-responsive-image/index.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/ember-cli/lib/models/package-info-cache/package-info.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/ember-cli/lib/models/package-info-cache/index.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/ember-cli/lib/models/project.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/ember-cli/lib/utilities/get-config.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/ember-cli/lib/utilities/instrumentation.js
- <repo>/node_modules/.pnpm/[email protected]/node_modules/ember-cli/lib/cli/index.js
- 🏠/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/ember-cli/bin/ember

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install


Stack Trace and Error Report: /tmp/error.dump.46ef403e3e5ffe199b5b706cf676ddd9.log
An error occurred in the constructor for empress-blog-casper-template at <repo>/node_modules/.pnpm/[email protected]_esapxe3kejb4lqw2py4aj4c77u/node_modules/empress-blog-casper-template}

cc @mansona (author of empress-blog-casper-template)

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

❯ pnpx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
.../share/pnpm/store/v3/tmp/dlx-1593827  |   +1 +
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: 🏠/.local/share/pnpm/store/v3
  Virtual store is at:             ../../../.local/share/pnpm/store/v3/tmp/dlx-1593827/node_modules/.pnpm
.../share/pnpm/store/v3/tmp/dlx-1593827  | Progress: resolved 1, reused 1, downloaded 0, added 1, done

  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 2.16 GB / 31.14 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 14.17.5 - ~/.volta/tools/image/node/14.17.5/bin/node
    Yarn: 1.22.11 - ~/.volta/tools/image/yarn/1.22.11/bin/yarn
    npm: 6.14.14 - ~/.volta/tools/image/node/14.17.5/bin/npm
  npmPackages:
    sharp: ^0.31.0 => 0.31.0 }

Solution

Here is my solution, and if there is a better, more correct way, please let me know:

❯ cd node_modules/sharp
❯ pnpm install
❯ pnpm run install

> [email protected] install <repo>/node_modules/.pnpm/[email protected]/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Using cached 🏠/.npm/_libvips/libvips-8.13.1-linux-x64.tar.br
sharp: Integrity check passed for linux-x64}

This is likely a hack, because it's using .npm as the cache folder, and pnpx has no clue what's in there post-above-hack:

❯ pnpx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
.../share/pnpm/store/v3/tmp/dlx-1597250  |   +1 +
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: 🏠/.local/share/pnpm/store/v3
  Virtual store is at:             ../../../.local/share/pnpm/store/v3/tmp/dlx-1597250/node_modules/.pnpm
.../share/pnpm/store/v3/tmp/dlx-1597250  | Progress: resolved 1, reused 1, downloaded 0, added 1, done

  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 1.92 GB / 31.14 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 14.17.5 - ~/.volta/tools/image/node/14.17.5/bin/node
    Yarn: 1.22.11 - ~/.volta/tools/image/yarn/1.22.11/bin/yarn
    npm: 6.14.14 - ~/.volta/tools/image/node/14.17.5/bin/npm
  npmPackages:
    sharp: ^0.31.0 => 0.31.0 }
@lovell
Copy link
Owner

lovell commented Sep 6, 2022

Yes, as you suggest, you can run the install script yourself if you do not wish your package manager to do so.

it's using .npm as the cache folder

This can be controlled with the npm_config_cache environment variable.

Ultimately, the need to run an install script will (hopefully) be removed by the proposed distributions property - see npm/rfcs#519

@haryelramalho
Copy link

There's no better solution yet?

I'm trying to build the project with jenkins...

If the best solution until now is install the script manually, maybe I should create an script to run this before pnpm install.

@lovell
Copy link
Owner

lovell commented Sep 26, 2023

Please subscribe to #3750 for updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants