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

Open
jbeard4 opened this Issue Jan 17, 2012 · 7 comments

Projects

None yet

8 participants

@jbeard4

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.

@jdalton

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

@jbeard4
@ralt

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

@domenic
npm member

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

@mfncooper
npm member

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)
@timoxley
npm member

@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 Oct 17, 2014
@smikes

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"
}
EOF
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment