<h3 dir="auto">Current Behavior:</h3>

<p dir="auto">The docs for npm@7 mention hook scripts as a feature:</p>
<blockquote>
<p dir="auto">If you want to run a specific script at a specific lifecycle event for ALL packages, then you can use a hook script.</p>
<p dir="auto">Place an executable file at <code class="notranslate">node_modules/.hooks/{eventname}</code>...</p>
</blockquote>
<p dir="auto">^ <a href="https://github.com/npm/cli/blob/latest/docs/content/using-npm/scripts.md#hook-scripts">https://github.com/npm/cli/blob/latest/docs/content/using-npm/scripts.md#hook-scripts</a></p>
<h3 dir="auto">Expected Behavior:</h3>

<p dir="auto">This section should be removed from NPM docs since the hook script functionality no longer works. It appears to be no longer supported in npm@7, according to the @npmcli/run-script readme:</p>
<blockquote>
<p dir="auto">Hook scripts are not run by this module. If the caller wishes to run hook scripts, then they can override the default package script with an explicit cmd option pointing to the node_modules/.hook/${event} script.</p>
</blockquote>
<p dir="auto">^ <a href="https://github.com/npm/run-script#differences-from-npm-lifecycle">https://github.com/npm/run-script#differences-from-npm-lifecycle</a></p>
<h3 dir="auto">Steps To Reproduce:</h3>

<p dir="auto">n/a</p>
<h3 dir="auto">Environment:</h3>

<p dir="auto">n/a</p>
<p dir="auto">First of all, thanks for all of the work being done on the npm CLI and the ecosystem! Tons of new amazing things in v7.</p>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">Hook scripts (documented <a href="https://docs.npmjs.com/cli/v7/using-npm/scripts#hook-scripts" rel="nofollow">in the docs here</a>) seem to no longer get run for npm v7.</p>
<p dir="auto">For example, an executable file at <code class="notranslate">node_modules/.hooks/postinstall</code> with the following contents not get run:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#!/usr/bin/env node
console.log('ran hook');"><pre class="notranslate">#!/usr/bin/env node
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'ran hook'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">I also tried this:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#!/usr/bin/env bash
echo 'ran hook'"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#!</span>/usr/bin/env bash</span>
<span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">'</span>ran hook<span class="pl-pds">'</span></span></pre></div>
<p dir="auto">This will not get run during <code class="notranslate">npm install</code> or <code class="notranslate">npm install &lt;pkg name&gt;</code></p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">The hook scripts should be run</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>Create a new package with one of the file contents above in an executable file under <code class="notranslate">node_modules/.hooks/postinstall</code></li>
<li>Run <code class="notranslate">npm install</code></li>
<li>Hook script does not get run</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: macOS 11.2.1</li>
<li>Node: 15.8.0</li>
<li>npm: 7.5.4</li>
</ul>
<h3 dir="auto">Alternatives considered</h3>
<p dir="auto">Maybe Hook Scripts are no longer supported? In this case, they should be removed from the documentation.</p>