npm / npx

npm package executor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] npx is using Yarn's cache to resolve dependencies

RomainLanz opened this issue Β· comments

Hey there! πŸ‘‹

What / Why

It seems that npx is sometime using Yarn's cache to resolve dependencies (maybe to make it faster?).

This is not the intended behavior since Yarn's cache could be outdated and it create many bugs during installation.

Here's an issue of our CLI failing due to this.

I've myself ran into this issue once.

# Using npx --ignore-existing create-adonis-ts-app blog

fatal     TypeError: Cannot read property 'MustacheFile' of undefined
    at instructions (/Users/romainlanz/workspace/screencasts/blog/node_modules/@adonisjs/core/build/instructions.js:19:33)
    at Object.executeInstructions (/Users/romainlanz/.config/yarn/global/node_modules/@adonisjs/sink/src/executeInstructions.js:47:15)
    at async task (/Users/romainlanz/.config/yarn/global/node_modules/create-adonis-ts-app/build/tasks/executeInstructions.js:27:13)
    at async Object.runTasks (/Users/romainlanz/.config/yarn/global/node_modules/create-adonis-ts-app/build/index.js:138:13)

I've ended up uninstalling yarn to make it works.

Current Behavior

It uses Yarn's cache instead of re-fetching a dependency, even with --ignore-existing flag.

Steps to Reproduce

There's no real step to reproduce, since you need to have used Yarn once and have an update that break the cache.

Expected Behavior

npx should download all new dependency instead of relying on Yarn's cache.

Closing since I've probably found the bug and it's not in the repository!