0

I would like to know if it is possible to defien in npm package.json a specific folder for a dependency.

For example I would like to install dojo not in the default node_modules but on an arbitrary directory.

Notes: I am aware of bower, but I would be interested to know if it is possible to do it with npm and package.json alone. Thanks.

{
  "name": "xxx",
  "version": "1.0.0",
  "main": "index.js",
  "keywords": [
    "dojo"
  ],
  "author": "",
  "dependencies": {
    "dojo":"^1.10.4",
    "connect":"^3.4.1",
    "open":"^0.0.5"
  }
}
GibboK
  • 71,848
  • 143
  • 435
  • 658
  • I don't think so.... – narainsagar Feb 08 '16 at 19:48
  • 1
    I don't know any way, but why would you **ever** do that? – Andrey Popov Feb 08 '16 at 19:49
  • You can symlink the module in the _postinstall_. – Thomas Bormans Feb 08 '16 at 19:56
  • @AndreyPopov mainly for curiosity, but also would be good to use only npm install and a single package.json to fetch even front end dependencies :) – GibboK Feb 08 '16 at 20:08
  • 1
    Well yeah, it turned out you can. See [here](http://stackoverflow.com/questions/14742553/npm-local-install-package-to-custom-location) and [here](http://stackoverflow.com/questions/14469515/how-to-npm-install-to-a-specified-directory). If you're feeling adventurous you can also serve static files within the node_modules directory.. ;) – Andrey Popov Feb 08 '16 at 20:37

0 Answers0