NPM installation does not start babel assembly if dependencies do not come from NPM

For example, if in my .json package I have this:

 "dependencies": {
     "cacheman": "2.1.0"   }

it works, and it runs the building script inside the cacheman when I install npm.

however, if I do this:

 "dependencies": {
     "cacheman": "https://github.com/cayasso/cacheman.git"   }

it will not work. Installing npm will not start the build process for the cacheman.

why?

+4
source share
1 answer

The script you are referring to is a pre-publishing script that runs before the npm module is published to the npm registry. Check package.json # L9

Excerpt shown here.

"scripts": {
    "test": "make test",
    "prepublish": "make"
}

When you install it from github, there is no publishing step, so the script does not run.

github script, postinstall script cacheman ( , , ).

"scripts": {
    "test": "make test",
    "prepublish": "make",
    "postinstall": "make"//Added postinstall
}

examples npm.

+4

Source: https://habr.com/ru/post/1625395/


All Articles