Giter VIP home page Giter VIP logo

heroku-buildpack-pnpm's People

Contributors

dependabot[bot] avatar hampusborgos avatar jasiekkrk avatar tamomaes avatar thesecuritydev avatar turbo87 avatar yeion7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

heroku-buildpack-pnpm's Issues

Regression: missed `pnpm`

Describe the bug

With recent update I have an issue:

remote: Compressing source files... done.        
remote: Building source:        
remote: 
remote: -----> Building on the Heroku-20 stack        
remote: -----> Using buildpacks:        
remote:        1. https://github.com/unfold/heroku-buildpack-pnpm
remote:        2. heroku/ruby        
remote: -----> Node.js app detected        
remote:                
remote: -----> Creating runtime environment        
remote:                
remote:        NPM_CONFIG_LOGLEVEL=error        
remote:        NODE_VERBOSE=false        
remote:        NODE_ENV=production        
remote:        NODE_MODULES_CACHE=true        
remote:                
remote: -----> Installing binaries        
remote:        engines.node (package.json):  16.15.1        
remote:        engines.npm (package.json):   unspecified (use default)        
remote:                
remote:        Resolving node version 16.15.1...        
remote:        Downloading and installing node 16.15.1...        
remote:        Using default npm version: 8.11.0        
remote: -----> Install pnpm        
remote:        ==> Extracting pnpm binaries 7.1.9        
remote:        Could not infer shell type.        
remote:                
remote:        Setup complete. Open a new terminal to start using pnpm.        
remote: /tmp/codon/tmp/buildpacks/a4d02563694a7c675b0e6f14a16ea672fe9b6808/bin/compile: line 227: pnpm: command not found        
remote: 
remote: -----> Build failed          

Versions (please complete the following information):

  • Heroku Stack: heroku-20
  • Node Version: 16.15.1
  • NPM or Yarn Version: npm 8.11.0
  • Buildpack Version:
remote:        1. https://github.com/unfold/heroku-buildpack-pnpm
remote:        2. heroku/ruby   

PNPM_VERSION env var is not respected anymore if the version is specified in the package.json

Describe the bug
The documentation says that we can set the PNPM_VERSION env var to control which pnpm version is installed during the heroku build.
However, when we set the engines.pnpm in the package.json, the buildpack is using that value over the env var which is not what I'd expect reading the documentation.
For us, this is not a big deal, it was just surprising. I'm also not sure this was an intentional change or just a coincidence. Probably it's worth documenting and/or fixing.
I think this commit introduced this new behaviour.

To Reproduce
Steps to reproduce the behavior:

  1. Set the pnpm version in the package.json like this:
"engines": {
    "node": "16.x",
    "pnpm": "8.x"
  }
  1. Set the PNPM_VERSION env var in your Heroku app to 7.30.5
  2. Build your app
  3. See that the buildpack is installing pnpm 8.2.0

Versions (please complete the following information):

  • Heroku Stack: heroku-22
  • Node Version: 16.20.0
  • NPM or Yarn Version: NPM 8.19.4
  • Buildpack Version: latest

Additional context
Add any other context about the problem here.

bin/compile: line 233: pnpm: command not found

Describe the bug
With the new version of buildpack, the script to respect engines.pnpm seems to break pnpm install.

if $PNPM; then
meta_set "build-step" "install-pnpm"
echo "Downloading and installing pnpm..."
if [ -z "$pnpm_engine" ]; then
curl -sL https://unpkg.com/@pnpm/self-installer | node
else
curl -sL https://unpkg.com/@pnpm/self-installer | PNPM_VERSION=$pnpm_engine node
fi
pnpm config set store-dir "$CACHE_DIR"/.pnpm-store
echo "pnpm $(pnpm --version) installed"
fi

Seeing this in logs

2023-04-04 16:41:17        Downloading and installing pnpm... /tmp/codon/tmp/buildpacks/6850fdb5590ef7398f98be618d4e33eed777eadc/bin/compile: line 233: pnpm: command not found

Looks like the script didn't wait until the install complete and start calling pnpm.

node: command not found

Hello 👋

I'm trying to use buildpack and it works okay for build stage but the app itself fail to start. I get node: command not found

image

image


Procfile

web: node dist/server.js

Any ideas or workarounds? Thanks in advance

ERR_PNPM_PREPARE_PKG_FAILURE

I installed the buildpack on heroku, activated via corepack pnpm and then did a deployment test. The error message I get is the classic ERR_PNPM_PREPARE_PKG_FAILURE.

Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /app/.local/share/pnpm/store/v3
Virtual store is at: node_modules/.pnpm
 ERR_PNPM_PREPARE_PKG_FAILURE  Command failed with exit code 1: pnpm install
Progress: resolved 275, reused 273, downloaded 0, added 0

Steps to reproduce the behavior:

  1. Set up your buildpack from the heroku dashboard and removed the default buildpack
  2. Activated pnpm via corepack (corepack enable => corepack prepare pnpm@ --activate)
  3. Deploy nodejs server (also installing dependencies by hand via install command)
  • Heroku Stack: heroku-22
  • Node Version: 18.7.0
  • NPM or Yarn Version: Yarn 1.22.19, Npm: 8.15.0]
  • Buildpack Version: heroku-buildpack-pnpm

Node_modules not caching when deploying on dokku

Describe the bug
Hey, I'm using dokku to deploy my nestjs app. It seems that my node modules are never cached, can anyone help me figure out why?

I see that it says pnpm (nothing to cache) and dont understand why isnt there anything to cache?

Here's the log:
https://gist.github.com/rohanrajpal/bc7cc3b14b3f7f3866826b0aea84f004

To Reproduce
Steps to reproduce the behavior:

  1. Setup dokku.com on any ec2 instance
  2. Deploy a nestjs app setup with pnpm
  3. Node modules are never cached

Versions (please complete the following information):

  • Heroku Stack: gliderlabs/herokuish:latest-22
  • Node Version: 18.12.1
  • NPM or Yarn Version: pnpm - 7.16.1

Additional context
The build log shared above has a lot more details

My best guess is that the path of caching is set incorrectly? Happy to make a PR if someone can point me in the right direction to fix this

Prune dev dependencies step also runs prepare script

Describe the bug

I'm using the buildpack to install dependencies. My application has a prepare script which generates css classes and graphql codegen using the nx tool. The nx tool is a dev dependency. When building the app in Heroku the following steps take place:

  1. pnpm install
  2. prepare script runs
  3. prod build script runs
  4. dev dependencies are pruned
  5. prepare script runs again

The build fails when step 5 attempts to run the prepare script as it requires dev dependencies.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy a next js app to heroku that has a dev dependency that is used in the prepare script
  2. Create a manual deploy in Heroku
  3. Notice that the prepare script attempts to run during the Pruning devDependencies step

Versions (please complete the following information):

  • Heroku Stack: heroku-22
  • Node Version: 20.4.0
  • NPM Version: npm 8.x
  • PNPM Version: 8.6.9
  • Buildpack Version: latest

Additional context

Log file for the Pruning devDependencies step in Heroku build

-----> Pruning devDependencies
       
       devDependencies:
       - ... 
       - nx 16.5.0
       - ...
       
       
       > [email protected] prepare /tmp/build_6499ea3f
       > nx generate-css && nx generate-gql
       
       sh: 1: nx: not found
        ELIFECYCLE  Command failed.
-----> Build failed

Support --no-optional (skip optional dependencies)

I'd like to have an option to skip installation of optional dependencies. Currently, this option sadly isn't supported even at the official Heroku node.js buildpack.

I believe the user should have the optional to add some boolean Heroku environment variable specifying weather to install optional deps. or not.

All the three package manager supports the option --no-optional. This saves time of installing testing or lintinting packages unnecessary for the final deployment.

Pruning devDependencies asks me to remove and reinstall from scratch.

Describe the bug
I am trying to deploy a landing page (next.js app) to heroku using monorepo architecture. The problem occurs while pruning devDependencies. It tries to receive an input whether the devDependencies can be removed.

To Reproduce
Steps to reproduce the behavior:

  1. turbo build --filter=landing-page

Versions (please complete the following information):

  • Heroku Stack: heroku/8.7.1

  • Node Version: 20.11.0

  • PNPM Version: 8.15.0

  • turbo Version: ^1.11.3

Additional context

remote: -----> Pruning devDependencies
remote:        ? The modules directory at "/tmp/build_bbb22d47/apps/backend/node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n) ‣ ? The modules directory at "/tmp/build_bbb22d47/apps/console/node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n) ‣ ? The modules directory at "/tmp/build_bbb22d47/packages/ts-config/node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n) ‣ ? The modules directory at "/tmp/build_bbb22d47/packages/ui/node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n) ‣ ? The modules directory at "/tmp/build_bbb22d47/apps/client/node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n) ‣ ? The modules directory at "/tmp/build_bbb22d47/apps/landing-page/node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n) ‣ (node:2325) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 keypress listeners added to [ReadStream]. Use emitter.setMaxListeners() to increase limit
remote:        (Use `node --trace-warnings ...` to show where the warning was created)
remote:        
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote: 
remote: -----> Compressing...
remote:  !     Compiled slug size: 512.6M is too large (max is 500M).
remote:  !     See: http://devcenter.heroku.com/articles/slug-size
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to prayers-landing-page.

This is my folder architecture:
Screenshot 2024-01-29 at 21 06 15

Describe the solution you'd like
I would like to force-prune the devDependencies. Or default set the answer yes. Don't know if it's even possible but throwing it out there.

Can we start adding GitHub 'releases' per version of this buildpack?

Is your enhancement request related to a problem? Please describe.
I went to look for a release thinking it would be made for each version as described in the Changlelog.

Describe the solution you'd like
Ideally, each time a new version is published a GitHub release is created based on the code in the main branch. Then we can use GitHub to see differences in versions and pull a specific release if needed.

Describe alternatives you've considered
Not sure if Heroku buildpacks have versions too.

Additional context
Nope

Install dev dependencies to compile project

Is your enhancement request related to a problem? Please describe.
Many Node dependencies, such as TypeScript, are used as dev dependencies, meaning they are required to initially compile project, but are not required later in production. This means any project that relies on TS or other libraries to compile would fail during build time.

Describe the solution you'd like

  1. Install all dependencies
  2. Build project
  3. Remove dev dependencies

Describe alternatives you've considered
Moving dependencies from dev to production list helps to solve immediate problem, but it in turn creates a problem of having dev dependencies in production, which is considered bad solution.

Additional context
image
image

Downloading PNPM fails

Running the install command curl -sL https://unpkg.com/@pnpm/self-installer | node fails now with:

[stdin]:1
<!DOCTYPE html>
^

SyntaxError: Unexpected token '<'
    at new Script (node:vm:100:7)
    at createScript (node:vm:257:10)
    at Object.runInThisContext (node:vm:305:10)
    at node:internal/process/execution:81:19
    at [stdin]-wrapper:6:22
    at evalScript (node:internal/process/execution:80:60)
    at node:internal/main/eval_stdin:29:5
    at Socket.<anonymous> (node:internal/process/execution:212:5)
    at Socket.emit (node:events:406:35)
    at endReadableNT (node:internal/streams/readable:1329:12)

I think it's related to the latest commit: 76cf1fc

Can it be changed to the new URL so we're not using unpkg.com?

Husky not found

Hi,

I'm trying to use this buildpack, but it only works (builds) if I move everything from devDependencies to dependencies in package.json.

My errors :
husky: not found
when I move husky to dependencies, then I have tsc not found, and so on.
Looks like it installs only the dep and not the devDep.

Any idea or some workarounds?
Thanks in advance

Allow --filter argument for selectively installing dependencies

Is your enhancement request related to a problem? Please describe.
The size of our dependencies are way too big when used with a monorepo as it installs every dependency in the monorepo
image

Describe the solution you'd like
pnpm --filter=package install allows you to selectively install dependencies for the repo you're working with to avoid having unused dependencies

Describe alternatives you've considered
You can just like... ignore it I guess but that's not really a solution. It's also not possible to delete dependencies after you install them without a ton of trouble

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.