How to automatically copy files from package to local directory via postinstall npm script?

Since npm 3.4 you can use the $INIT_CWD envar:
https://blog.npmjs.org/post/164504728630/v540-2017-08-22

When running lifecycle scripts, INIT_CWD will now contain the original working directory that npm was executed from.

To fix you issue add to your postinstall script in package.json the following:

  "scripts": {
    "postinstall": "cp fileYouWantToCopy $INIT_CWD",
  },

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)