arloliu / copy-node-modules

Fast deploy Node.js modules from local source folder to distination folder
26 stars 14 forks source link

No such file or director if address package-name mismatch #18

Open andypillip opened 5 years ago

andypillip commented 5 years ago

Thanks for the useful package! Just what I need.

Apparently yarn and npm use the name from either the dependencies or from the address for the directory in node_modules, while copy-node-modules uses the package's name from it's packages.json.

If the maintainer did a mistake, this will result in copy-node-modules to fail, while yarn and npm work file.

Example:

packages.json

  "dependencies": {
    "jquery.accessible-accordion": "nomensa/jquery.accessible-accordion",

node_modules/jquery.accessible-accordion/package.json

  "name": "jquery-accessible-accordion",

Results in copy-node-modules failing:

$ copy-node-modules
Error: Error: ENOENT: no such file or directory, stat '…/node_modules/jquery-accessible-accordion'

Thanks for having a look.