paketo-buildpacks / yarn-install

A Cloud Native Buildpack for Yarn
Apache License 2.0
8 stars 8 forks source link

Yarn workspace not working when using nohoist #4

Closed beku8 closed 4 years ago

beku8 commented 5 years ago

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version?

{
   "name": "",
   "build": "",
   "support": "https://support.run.pivotal.io",
   "version": 0,
   "description": "Cloud Foundry sponsored by Pivotal",
   "authorization_endpoint": "https://login.run.pivotal.io",
   "token_endpoint": "https://uaa.run.pivotal.io",
   "min_cli_version": "6.22.0",
   "min_recommended_cli_version": "latest",
   "app_ssh_endpoint": "ssh.run.pivotal.io:2222",
   "app_ssh_host_key_fingerprint": "e7:13:4e:32:ee:39:62:df:54:41:d7:f7:8b:b2:a7:6b",
   "app_ssh_oauth_client": "ssh-proxy",
   "doppler_logging_endpoint": "wss://doppler.run.pivotal.io:443",
   "api_version": "2.133.0",
   "osbapi_version": "2.14",
   "routing_endpoint": "https://api.run.pivotal.io/routing",
   "user": "dc8ffa86-9ab4-4655-bcef-2bb02a43078f"
}
cf version 6.38.0+7ddf0aadd.2018-08-07

What version of the buildpack you are using? nodejs-buildpack

I'm trying to deploy a nodejs app organized in yarn workspace. We use the nohoist feature, thus our package.json "workspace" structure is bit different. We conform to the following structure:

"workspaces": {
    "packages": ["packages/*"],
    "nohoist": ["**/react-native", "**/react-native/**"]
  }

However the buildpack doesn't pick up this structure:

Staging app and tracing logs...
   Downloaded app package (21.3M)
   Downloaded build artifacts cache (181.1M)
   -----> Download go 1.11.5
   -----> Running go build supply
   /tmp/buildpackdownloads/ddcdba8d520546385414ac76bc084798 ~
   ~
   -----> Nodejs Buildpack version 1.6.48
          **WARNING** buildpack version changed from 1.6.46 to 1.6.48
   -----> Installing binaries
          engines.node (package.json): ^8.12.0
          engines.npm (package.json): unspecified (use default)
   -----> Installing node 8.15.1
          Copy [/tmp/cache/final/dependencies/2132941ad918127765b1ea0f9d784441a06a9f07717fa2d3980ff200889be578/node-8.15.1-linux-x64-cflinuxfs3-bed0d0e6.tgz]
          Using default npm version: 6.4.1
   -----> Installing yarn 1.15.2
          Copy [/tmp/cache/final/dependencies/f0b0c3270dff2f11d91915a30302f19f6e252fcd55c95188bcedbd532c7412e2/yarn-1.15.2-any-stack-c4feca9b.tar.gz]
          Installed yarn 1.15.2
   -----> Creating runtime environment
          **ERROR** Failed parsing package.json: json: cannot unmarshal object into Go struct field .workspaces of type []string
   Failed to compile droplet: Failed to run all supply scripts: exit status 14
   Exit status 223
   Cell 52f83266-c73f-4215-935f-960455846157 stopping instance 31fd1fcc-d4bb-4752-8b41-264d6f730fdd
   Cell 52f83266-c73f-4215-935f-960455846157 destroying container for instance 31fd1fcc-d4bb-4752-8b41-264d6f730fdd
Error staging application: App staging failed in the buildpack compile phase
FAILED

Please confirm where necessary: [] I have included a log output [] My log includes an error message *[] I have included steps for reproduction

cf-gitbot commented 5 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/165410953

The labels on this github issue will be updated when the story is started.

tylerphelan commented 5 years ago

@beku8 this makes sense! We will prioritize this soon. If you want it adopted quicker you could make a PR and we would take a look!

dfreilich commented 5 years ago

@beku8 We're in the middle of a rewrite of the buildpacks, porting them to cloud native buildpacks, so I assume this won't be added to the nodejs-buildpack. You may want to experiment with the [yarn-cnb](github.com/cloudfoundry/yarn-cnb], though I suspect that it won't solve your issue just yet. I'll port this issue over there.

cf-gitbot commented 5 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/168768081

The labels on this github issue will be updated when the story is started.

kvedurmu commented 4 years ago

This is now supported in the latest release

If you're interested in using this in CF, the next NodeJS CNB CF-Compatible CNB release artifact will support this behavior.