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

Caching issue with local (i.e. "file:...") dependencies #387

Closed
jmike opened this issue Mar 31, 2017 · 6 comments
Closed

Caching issue with local (i.e. "file:...") dependencies #387

jmike opened this issue Mar 31, 2017 · 6 comments

Comments

@jmike
Copy link

jmike commented Mar 31, 2017

Hey,

I 've got a git repo with some local dependencies. Here's how my package.json looks like:

{
  "name": "foobar",
  "version": "0.1.0",
  "dependencies": {
    "mysql-database": "file:./commons/mysql-database"
  }
}

Notice the file:./commons/mysql-database string, which signifies a local dependency.

The above works perfectly fine when uploading to heroku, as long as caching is disabled. When I enable caching I get the following error:

remote:        npm ERR! addLocal Could not install /tmp/build_b7f17036f4981cab00406ab0a8f4b3b7/commons/mysql-database
remote:        npm ERR! Linux 3.13.0-112-generic
remote:        npm ERR! argv "/tmp/build_6965e58613208ae8ee3ff9ccb502b3cd/.heroku/node/bin/node" "/tmp/build_6965e58613208ae8ee3ff9ccb502b3cd/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_6965e58613208ae8ee3ff9ccb502b3cd/.npmrc"
remote:        npm ERR! node v7.8.0
remote:        npm ERR! npm  v4.2.0
remote:        npm ERR! path /tmp/build_b7f17036f4981cab00406ab0a8f4b3b7/commons/mysql-database
remote:        npm ERR! code ENOENT
remote:        npm ERR! errno -2
remote:        npm ERR! syscall open

A couple of notes:

  1. This only happens when caching is warm, i.e. after the second git push heroku - which kinda makes sense.
  2. The mysql-database package gets transpiled with babel-cli using a postinstall script. Again this works perfectly fine without caching.

My project is quite big, so caching is much necessary. Any help I could get is much appreciated.

@jmorrell
Copy link
Contributor

jmorrell commented May 3, 2017

Hmm... I tried to set up a repro example for this and couldn't get it to error: https://github.com/jmorrell/npm-local-dependency-ex

How is your setup different?

@jmike
Copy link
Author

jmike commented May 4, 2017

@jmorrell many thanks for looking into this.

I don't seem to be able to replicate this issue, even though I spent a full hour tweaking your code to look more like what I have.

Apparently I am doing something wrong, but I can't afford any more time to look into it. Feel free to close the issue for now.

@jmorrell
Copy link
Contributor

jmorrell commented May 5, 2017

Closing. Thanks for teaching me that local dependencies are a thing :)

@jmorrell jmorrell closed this as completed May 5, 2017
@stropho
Copy link

stropho commented May 4, 2020

@jmike I see it has been a while, but do you remember where the problem was? I'm having the same/similar issue and can't figure it out.
I'm trying to install a package from a local tarball

@jmike
Copy link
Author

jmike commented May 4, 2020

@stropho I never found what the issue really was.

I suggest you simply use yarn workspaces and get done with it.

@stropho
Copy link

stropho commented May 6, 2020

well, after an hour or so I felt really stupid. My issue was the "universal" .gitignore file. By default it ignored all .tgz files, nested dist/ folders etc. So the file I wanted to install never got to git 😮 😂

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

No branches or pull requests

3 participants