Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Question: should you be able to combine the flags --prefix and --save-dev and use them at the same time? #5696

Closed
u01jmg3 opened this Issue · 4 comments

3 participants

@u01jmg3

I know there are problems with --prefix at the moment (#5459) but when I try and combine this flag with --save-dev, my package.json is not updated.

My question is, is that the correct behaviour?

@u01jmg3 u01jmg3 changed the title from Question: should you be able to combine the flags --prefix and --save-dev and use at the same time? to Question: should you be able to combine the flags --prefix and --save-dev and use them at the same time?
@othiym23 othiym23 added the support label
@smikes

Is this still a problem for you?

When I test with npm@2.1.8 which is the latest version, I find the following behavior:

When $prefix/package.json does not exist:

$ npm install --prefix=$prefix --save-dev package
# install succeeds, package.json is not created

When $prefix/package.json does exist:

$ npm install --prefix=$prefix --save-dev package
# install succeeds, package.json is updated

We are trying to clean up older npm issues, so if we don't hear back from you within a week, we will close this issue. (Don't worry -- you can always come back again and re-open it!)

Thanks!

@othiym23
Owner

Closing as resolved / abandoned.

@othiym23 othiym23 closed this
@u01jmg3

Apologies I am late replying

I can confirm that this works for me using Node 0.10.33 / npm 1.4.28 on Windows

Although it works the end result/structure is not quite what I expected. This was the end result from a quick test:

./
    test/
        test/node_modules/
            test/node_modules/jquery/
        test/package.json

Whereas I expected the end result/structure to be more like:

./
    test/
        test/jquery/
    package.json

Also, would it be useful to warn the user if the --save-dev flag is needlessly being used when package.json does not exist to update?

@smikes

the node_modules directory is part of how node locates and resolves dependencies. For the full story, see here: http://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders

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.