Frequently Asked Questions - this is not a complete list so expect more to be added over time...
- "How do I speed up
install
?" - "How do I fix a failing
install
?" - "How do I generate a
npm-debug.log
?" - "How can I get a
npm-debug.log
out of GitHub Actions/Workflows?" - "How can I
audit
a package without installing it?" - "How can I fully cache or vendor my deps so they're available offline?"
- Use the latest
node
&npm
versions (ie.brew update && brew install node
&npm i -g npm@latest
) - If you don't need dev dependencies, add the flag
--production
- If you don't need to audit, add the flag
--no-audit
- If you already have some of your modules cached, add the flag
--prefer-offline
- Check if you're using the latest
node
&npm
- Check if the registry is down
- Check if your network is having issues (ie. slow or intermitant connection)
- Check if your network is blocking certain requests (ie. behind a corporate firewall)
- Check if speeding up your installs helps
- If you're project has peer dependecy conflict warnings or failures, try adding the flag
--legacy-peer-deps
- Add the flag
--timing
to any command run (ex.npm install express --timing
)
- Add a
actions/upload-artifact
step dedicated to saving debug logs as part of your workflow
# example: ./github/workflows/*.yml
- uses: actions/upload-artifact@v2
with:
name: npm-debug-logs
path: ~/.npm/_logs/*-debug.log
- Use this
npm-audit
bash script (note: it runsinstall
in a tmp directoy w/--package-lock-only
& thenaudit
- should avoid firewalls/network issues w/ downloading vulnerable tars)
- Set your
cache
config (ex. in.npmrc
cache = ./some-local-cache-dir
or w/npm config set cache ./some-local-cache-dir
) - Run
npm install
- You should now be able to run
npm install
w/ the flag--offline
or kill your network & it'll just work™️ - Example in the wild