Install package dependency without build, or else ignore build errors #2817

Closed
HeikoR opened this Issue Sep 19, 2012 · 19 comments
@HeikoR

Hi. This is a (possible) feature request (+1)

Our package has node-expat as dependency, but latest node-expat currently doesn't install on windows, since it gets a build error and fails.

  • we only require the node-expat source to be downloaded, as we link to it from our own gyp file.
  • currently we use npm install --force to force the installation of our package (which will then force node-expat dependency to be installed
  • we tried 'npm config set node-expat:force true' then 'npm install our-package-name' but this doesn't seem to work.
  • would be great to be able to add a parameter into our package.json file to force installation of a dependency, or to prevent it from being built

Other Recommendations:
1. to only download a package, not build (npm download node-expat)
2. or to download into cache (via npm cached add node-expat)
and then have npm extract node-expat d:\my_output_dir\

.H

@mfncooper
npm member

You could specify node-expat in optionalDependencies in your package.json, so that your installation does not fail if node-expat fails to build. Would that meet your needs?

@HeikoR

We still need the node-expat source to build one of our dependent packages. We just don't need the node-expat build stage since we use our own build script.

Either way - we have it working. Just thought that if there's more people that require "no-build" functionality, they could +1 it.

@sqs
sqs commented May 2, 2013

+1 to a no-build option for npm install. It is useful when you have (e.g.) a code editor and want to perform autocomplete (or other static analysis) for the user in the context of the current NPM package. There is no need to build the packages in that case.

@hermannpencole

+1 to a no-build option for npm install.
I want create a rpm package without binary

@gagle

+1. With a --no-build flag we can also distribute 2 versions of the same module under the same name: the pure javascript module (with --no-build) or the native module.

http://stackoverflow.com/questions/17299019/choosing-module-installation-javascript-or-native-module

@rlidwka

With a --no-build flag we can also distribute 2 versions of the same module under the same name: the pure javascript module (with --no-build) or the native module.

2 versions == 2 modules... just add a variable so the name could be changed only in one place

There were some discussions about different modules implementing the same api, but it has nothing to do with building.

@taxilian

I have a case where I need to "build" my source dir, complete with npm modules, and then archive them to be deployed to a server that doesn't have internet access. The problem is that when I put it on the new computer, I have to do npm rebuild; that's fine, and it works, but it would be a lot better if I didn't have to arbitrarily archive up a bunch of binaries that will never get used as well. I may have to find a way to manually delete all build artifacts.

@sqs sqs added a commit that referenced this issue Aug 25, 2013
@sqs sqs Add --ignore-scripts option that causes `npm install` to not run prei…
…nstall and prepublish scripts (closes #2817)
6fdba31
@sqs sqs added a commit that referenced this issue Aug 25, 2013
@sqs sqs Add --ignore-scripts option that causes `npm install` to not run prei…
…nstall and prepublish scripts (closes #2817)
79d4d6e
@sqs sqs added a commit that referenced this issue Aug 25, 2013
@sqs sqs Add --ignore-scripts option that causes `npm install` to not run prei…
…nstall and prepublish scripts (closes #2817)
ed597ff
@sqs

I've submitted a PR to implement an npm install --ignore-scripts option at #3824. (Posting so that people who are subscribed to this issue get a notification.)

@sqs sqs added a commit that referenced this issue Aug 25, 2013
@sqs sqs Add --ignore-scripts option that causes `npm install` to not run prei…
…nstall and prepublish scripts (closes #2817)
fbdd37c
@jamesshore

+1. I check my node_modules folder into git, and I need to .gitignore the build files. If I can download the module without building it, I can check that in, run npm rebuild, and put everything that shows up into .gitignore.

(Is there a better way to do this that already exists?)

@sqs

To everyone watching this issue: npm 1.3.18, which incorporates #3824, was just released. It provides an --ignore-scripts flag that can be used with npm install to prevent package.json scripts from being run. I think that flag addresses this issue.

@domenic
npm member

Ah right, I knew there was an issue I forgot to close!

@domenic domenic closed this Dec 17, 2013
@bdrewery

--ignore-scripts does not satisfy the request here. Why not add a --nobuild or npm fetch option? There needs to be a way to just fetch dependencies and build them later.

You already have npm build, why no npm fetch?

I am trying to create bundled packages of some npm modules for FreeBSD Ports packages, and we explicitly need to fetch, extract, build, install in separate phases.

@callumlocke

Could someone please either reopen this, or give a reason to reject it?

See @bdrewery's comment above

@fschwiet

--ignore-scripts works great! Is it in the docs anywhere? I think a good keyword to have in that documentation is 'build' because I use it to isolate the part that might change if I npm rebuild in another environment.

@othiym23 othiym23 added the support label Sep 21, 2014
@efolio

+1 npm fetch would be useful.

My case : I need to fetch selenium-standalone but prevent its post-install script to try fetching the chrome-driver it wants : my corporate proxy blocks me.
I can retrieve the chrome-driver from other means (add "s" on the "http" in the url) and then place the content where it's supposed to be.
But here, npm refuses to let the package be if the install script fails…

--ignore-scripts does not prevent the install script to be executed BTW…

$ npm -v
1.3.14
$ npm i --save selenium-standalone --ignore-scripts
@givankin

+1 for documenting this. Opened an issue: npm/docs#130

@davidchambers

+1 for npm fetch.

@davidchambers

npm pack <name>@<version> is analogous to npm fetch.

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