Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Invalid .npmrc confi causes ENOTCACHED error #207

Open
IObert opened this issue Feb 15, 2019 · 2 comments
Open

Invalid .npmrc confi causes ENOTCACHED error #207

IObert opened this issue Feb 15, 2019 · 2 comments

Comments

@IObert
Copy link

IObert commented Feb 15, 2019

Hi,

I noticed that the line offline=true in the .npmrc file causes the following error (on two distinct machines):

C02W10MUHTD8:meta-azure-service-broker ----$ npm install
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/async failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/-----/.npm/_logs/2019-02-15T10_31_33_339Z-debug.log

It works fine when I remove the line (I noticed that this line has been added because of #199 but I didn't encounter that problem)

@zhongyi-zhang
Copy link
Contributor

zhongyi-zhang commented Feb 18, 2019

#199 only occurs in CF envs which don't allow to access npm registry. It does need offline=true in .npmrc to be pushed to CF. So it is a dilemma for the broker...… (Not like golang, nodejs doesn't keep vendors in the repo.) Yeah you can just delete it and run npm install. Or, a tricky way is to downgrade npm to 3.x (because older npm doesn't read project-level .npmrc, but your CF still knows it). Sorry for the inconvenience...

@kevinhillinger
Copy link
Member

kevinhillinger commented Sep 25, 2019

Per the documentation here, the better option is prefer-offline=true. Otherwise as is noted by @IObert, when building the service broker app, you must do the following on the bosh VM:

sudo npm install --offline=false --unsafe-perm=true --allow-root
rm ./package-lock.json

This forces the initial installation of all dependencies, which then allows the cf push to work.

If a CF environment doesn't have access to NPM repo, the issue is mute if we choose prefer-offline=true as the solution, since a pre-loaded node_modules will exist for those not able to pull them, and for those who don't have an issue accessing NPM repo, it will pull.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants