Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent npm install from picking up existing node_modules dirs #927

Closed

Conversation

@andreas-karlsson
Copy link
Contributor

@andreas-karlsson andreas-karlsson commented Apr 7, 2013

Currently meteor bundle will break if there exists a node_modules folder anywhere in a folder above the app dir.

This is due to the fact that if npm sees an existing node_modules folder in the current directory OR higher up in the folder tree, it will choose to install into it. (See https://npmjs.org/doc/folders.html under "More Information").

This fix creates a node_modules directly after creating the .npm folder so that npm install will work as expected.

@avital
Copy link
Contributor

@avital avital commented Apr 7, 2013

Thanks @andreas-karlsson, this looks great! I verified that this indeed fixes the problem, and I ran scripts/run-tools-test.sh which passes.

@avital
Copy link
Contributor

@avital avital commented Apr 7, 2013

Rebased and merged to devel manually.

@avital avital closed this Apr 7, 2013
avital added a commit that referenced this pull request Apr 8, 2013
Previously to fixing #927, if you had a 'node_modules' directory
anywhere up the directory tree from your app and you had a package
in your app using NPM, all calls to 'npm' ran against the 'node_modules'
directory it found, so neither 'node_modules' nor 'npm-shrinkwrap.json'
would be created within your package's .npm directory.

The fix to #927 ensured that 'node_modules' was first created within
'.npm' but people who had already run 0.6.0 were still in a corrupted state.
@avital
Copy link
Contributor

@avital avital commented Apr 8, 2013

Also see a subsequent commit unbreaking corrupted apps. b904459

rdickert added a commit to rdickert/meteor that referenced this pull request Jan 18, 2014
Package code pulled from a git repo does not contain the directory `/node_modules`, as these modules are downloaded during the build process. However, this can confuse NPM prior to build completion.

If the package directory doesn’t  have a '/node_modules' subdirectory, NPM will assume we are not at the package root and will search the directory's parents for one. It will then set the root to any ancestor that does have a '/node_modules' subdir. This can cause the build to fail for downloaded user packages and also Meteor itself if run from checkout.

See also meteor#927
glasser added a commit that referenced this pull request Feb 17, 2014
Fixes #1761.

Package code pulled from a git repo does not contain the directory
`/node_modules`, as these modules are downloaded during the build
process. However, this can confuse NPM prior to build completion.

If the package directory doesn’t have a '/node_modules' subdirectory,
NPM will assume we are not at the package root and will search the
directory's parents for one. It will then set the root to any ancestor
that does have a '/node_modules' subdir. This can cause the build to
fail for downloaded user packages and also Meteor itself if run from
checkout.

See also #927.
glasser added a commit that referenced this pull request Feb 17, 2014
Fixes #1761.

Package code pulled from a git repo does not contain the directory
`/node_modules`, as these modules are downloaded during the build
process. However, this can confuse NPM prior to build completion.

If the package directory doesn’t have a '/node_modules' subdirectory,
NPM will assume we are not at the package root and will search the
directory's parents for one. It will then set the root to any ancestor
that does have a '/node_modules' subdir. This can cause the build to
fail for downloaded user packages and also Meteor itself if run from
checkout.

See also #927.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.