<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>package-lock.json | no dogma blog</title><link>https://nodogmablog.bryanhogan.net/tag/package-lock.json/</link><atom:link href="https://nodogmablog.bryanhogan.net/tag/package-lock.json/index.xml" rel="self" type="application/rss+xml"/><description>package-lock.json</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Fri, 24 Jul 2026 00:00:00 +0000</lastBuildDate><image><url>https://nodogmablog.bryanhogan.net/media/icon_hu9c23d68d4e9f1f9acfa8237e5c2ea674_3344_512x512_fill_lanczos_center_3.png</url><title>package-lock.json</title><link>https://nodogmablog.bryanhogan.net/tag/package-lock.json/</link></image><item><title>Running npm in a Separate Container when using Claude</title><link>https://nodogmablog.bryanhogan.net/2026/07/running-npm-in-a-separate-container-when-using-claude/</link><pubDate>Fri, 24 Jul 2026 00:00:00 +0000</pubDate><guid>https://nodogmablog.bryanhogan.net/2026/07/running-npm-in-a-separate-container-when-using-claude/</guid><description>&lt;p>A few weeks ago &lt;a href="https://nodogmablog.bryanhogan.net/2026/06/claude-code-in-a-container/">I wrote about running Claude in a container&lt;/a> because I really don&amp;rsquo;t want it to have access to my computer. I mount a directory on my host into the container, and Claude can read and write files in that directory.&lt;/p>
&lt;p>Some of the applications I had Claude create for me use Node, and I had it lock down the versions of the dependencies. To do this, it created a &lt;code>.npmrc&lt;/code> that looks like this -
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">ignore-scripts&lt;/span>=&lt;span style="color:#5a2">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">save-exact&lt;/span>=&lt;span style="color:#5a2">true&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/p>
&lt;p>The next step in locking everything down is to generate a &lt;code>package-lock.json&lt;/code> file. But I had to run &lt;code>npm install&lt;/code> to generate this.&lt;/p>
&lt;p>Now I need to install Node and npm, definitely not something I want to do on my computer, or even in the container that I run Claude in.&lt;/p>
&lt;h3 id="the-workaround">The workaround&lt;/h3>
&lt;p>I started a new container with the same mounts as the Claude container, giving it access to the source code. Then I installed Node and npm in that container and ran &lt;code>npm install&lt;/code> to generate the &lt;code>package-lock.json&lt;/code> file.&lt;/p>
&lt;p>Here is the &lt;code>docker run&lt;/code> command -&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">docker run -it --rm --mount type&lt;/span>=&lt;span style="color:#5a2">bind,source=/home/bryan/dev/claude/,target=/root/dev alpine&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>Then in the container, I installed Node and npm -&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">apk add nodejs npm&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>Now I can run &lt;code>npm install&lt;/code> to generate the &lt;code>package-lock.json&lt;/code> file.&lt;/p>
&lt;p>Close the container, Node and npm are gone, but the &lt;code>package-lock.json&lt;/code> file is still there.&lt;/p>
&lt;p>This same approach can be used for any other tools you need to run.&lt;/p>
&lt;p>I love containers!&lt;/p></description></item></channel></rss>