Setting a .npmrc in a .netlify folder, and modifying the .toml file to read from that.
Using the suggested preinstall script netlify-preinstall.js and attaching that script to the preinstall hook.
Tried replacing .npmrc with .yarnrc
In these solutions, I have printed out the files/folders in my directory in the script to confirm that .npmrc is not created initially, and printing out files/folder and the contents of .npmrc after.
The .npmrc is confirmed to be created with the correct internal contents, but I still get a 401 error upon trying to download the package.
Error:
Request failed "401 Unauthorized"".
11:58:59 AM: info If you think this is a bug, please open a bug report with the information provided in “/opt/build/repo/yarn-error.log”.
The only solution that has worked is to put a .npmrc at the root of my repo, however this is non-ideal as it requires engineers to set the envvar in their zsh/bash or export those variables.
Let me know if there is something I am doing wrong.
Hey @kotybond, could you explain how exactly you did this? From my understanding, this file should exist in your base path. Did you change the base path in your TOML file?