Heroku cannot find local npm package

I have a local npm package included in my repo (I do not include all node_modules in my repo due to its size of more than 200 MB, only a specific package that I had to modify to suit my needs).

In package.json , the local package declaration is as follows:

 dependencies : { local_package: "./my_local_package" ... } 

the error i got

  npm ERR! enoent ENOENT: no such file or directory, open '/app/tmp/cache/my_local_package' 

I'm not sure that /app/tmp/cache is where my repo is located, and if that is not what I should change it.

node v4.2.1, npm v2.14.7

+6
source share
2 answers

According to the npm documentation for local paths , you should define it as follows:

 "dependencies" : { "local_package": "file:./my_local_package" ... } 
+1
source

Adding node_modules to git or clicking on a hero is not recommended.

So, one possible solution would be to have your local_package in a separate git repository, then you can do the following on package.json .

dependencies : { local_package: "git+https://example.com/local_package.git" ... }

I feel this is a nicer solution than having only local_package in your node_modules , and everyone else is ignored.

0
source

All Articles