npm (actually, yarn) not installing all package files, but only for a specific project

1

Before I go completely crazy, maybe someone has experienced a similar problem (otherwise, I guess I'll have to dive into the source...).

I have several packages on NPM. Usually I specify the "files" array in package.json so as to be able to exclude certain stuff (I write ES6 in the source, for instance). So, that works - no problem.

Now, one package, in particular, includes other files in its /dist/ folder (namely, some PNGs). The contents in the /dist/ folder get updated, but the PNGs are missing. I did rm -rf node_modules and reinstalled using yarn but to no avail. The package.json in the package's node_modules folder shows the correct version and contents. It's definitely the latest one.

(There's also an assets folder with the source PNGs - in dist there's a spritemap - which is also missing.)

Thinking I must be crazy, I made an empty project and ran

yarn init && yarn add $my-module. 

And whaddayaknow?

monomelodies@marijn:~/blabla$ ls node_modules/monad-theme-default/
assets  dist  LICENSE  package.json  README.md  sass
monomelodies@marijn:~/blabla$ ls node_modules/monad-theme-default/dist/assets/
i18n.png  logo.png
monomelodies@marijn:~/blabla$ 

So, that seems to work just fine. Which I expected it to, I examined the contents of npm pack and they were complete.

Looking at a different project using that package, it's also perfectly fine:

monomelodies@marijn:~/sites/projects/sensi/flirttracker$ ls node_modules/monad-theme-default/
assets  dist  LICENSE  package.json  README.md  sass
monomelodies@marijn:~/sites/projects/sensi/flirttracker$ 

Still somehow my other project doesn't get the correct files:

monomelodies@marijn:~/sites/projects/sensi/sensi$ rm -rf node_modules/
monomelodies@marijn:~/sites/projects/sensi/sensi$ yarn
yarn install v1.12.3
warning package.json: License should be a valid SPDX license expression
warning sensi@3.0.0: License should be a valid SPDX license expression
[1/6] Validating package.json...
warning sensi@3.0.0: License should be a valid SPDX license expression
[2/6] Resolving packages...
[3/6] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.7: The platform "linux" is incompatible with this module.
info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/6] Linking dependencies...
warning " > bootstrap@4.3.1" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.3.1" has unmet peer dependency "popper.js@^1.14.7".
warning " > angular-highlight-js@2.0.1" has unmet peer dependency "@angular/core@>=4.0.0 <5.0.0".
warning " > angular-highlight-js@2.0.1" has unmet peer dependency "highlight.js@^9.9.0".
warning " > karma-browserify@6.1.0" has unmet peer dependency "browserify@>=10 <17".
warning " > karma-browserify@6.1.0" has unmet peer dependency "watchify@>=3 <4".
[5/6] Building fresh packages...
[6/6] Cleaning modules...
Done in 13.89s.
monomelodies@marijn:~/sites/projects/sensi/sensi$ ls node_modules/monad-theme-default/
dist  LICENSE  package.json  sass

monomelodies@marijn:~/sites/projects/sensi/sensi$ cat package.json  | grep monad-theme
    "monad-theme-default": "^1.3.7",
monomelodies@marijn:~/sites/projects/sensi/sensi$ cat node_modules/monad-theme-default/package.json | grep version
  "version": "1.3.7",

Also, nothing weird in my .gitignore that I can see (not that methinks it should matter);

monomelodies@marijn:~/sites/projects/sensi/sensi$ cat .gitignore 
# oh for fuck's sake... :)
httpdocs/how_long.php
httpdocs/agy

.sass-cache

node_modules

src/Smile/tmp/smile*

bower_components

vendor

.twig-cache/*
.smile-cache/*
cache/*.png
cache/*.jpg
cache/*.jpeg

assets

httpdocs/css/*.css
httpdocs/js
httpdocs/admin
!httpdocs/admin/fonts

/tmp/
/uploads/

Versions.json

Anyone have any idea?

The only thing I can think of at this point is that the local .gitignore also lists a folder called /assets/, but seriously? It also doesn't explain the missing files in the package's /dist/ folder...

Marijn

Posted 2019-08-27T14:09:25.030

Reputation: 11

No answers