Skip to content


Subversion checkout URL

You can clone with
Download ZIP


"npm install" filters "build/" subdirectory by default #2048

jbeard4 opened this Issue · 7 comments

8 participants


I'm trying to package my node module with npm. My project has a sub-directory named "build/", and I've found that running "npm install" on my project will install all the files in the project to node_modules, except for the "build/" subdirectory. It therefore seems that "build/" is getting filtered by default. It's not clear from the documentation whether this is expected behavior, and whether it is possible to override it.


I have the same problem. Is there a way around it?


I can't see in the code where this is filtered. Any information about this @isaacs ?


I have had this problem too. I think it's in one of npm's dependencies.


Make sure none of the following ignore files include 'build' (or other things you don't want ignored):

  • project npm ignore file (./.npmignore)
  • user npm ignore file (npm config get userignorefile)
  • global npm ignore file (npm config get globalignorefile)
  • project git ignore file (./.gitignore or any subdirectory thereof)
  • global git ignore file (git config --global --get core.excludesfile)

@jbeard4 did you solve this issue? My guess is that build is in your project's .gitignore file, failing that, can you please check the locations in @mfncooper's response above?

@iarna iarna added the bug label

I am trying to construct a failing test for this issue in npm@2.1.14 and can't reproduce this behavior.

Here's what I have so far:

mkdir one two
cd one
mkdir build
touch a.js build/b.js
cat >package.json<<EOF
  "name": "one",
  "version": "1.0.0"
cd ../two
mkdir node_modules
npm i ../one
find node_modules/one/build

When I run this, I find that the contents of one/build have been installed under two/node_modules, and the file build/b.js does exist.

/cc @othiym23

@mattoshry mattoshry referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.