cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Blotsky <>
Subject Re: [DISCUSS] Copying node_modules during platform install
Date Wed, 28 Oct 2015 20:42:26 GMT
This use case does mostly affect Cordova contributors. Usually the platforms will come packaged,
you’re right. The discussion of packaged-vs-installed is separate, but just as a nod to
it: I don’t see a reason we can’t just automatically call “npm install” in platforms/ios/cordova.
Copying over a package.json with fixed versions is no more complex than copying over node_modules.


> On Oct 28, 2015, at 1:33 PM, Steven Gill <> wrote:
> Currently, those modules ship with the platform. Example, cordova-ios will
> have all necessary modules bundled in. When you create a cordova project
> and add a platform, it takes those modules and moves them into your newly
> created cordova project. To have the cordova project run `npm install` and
> install those modules would require us include those modules in a project
> level `package.json` file for every cordova project that adds that
> platform. This would confuse developers for sure. I don't think we would
> have to modify requires to have this work.
> To run `npm install` on those directories would also be very poor practice.
> By those directories, I assume you mean
> `MYCORDOVAPROJECT/platforms/ios/cordova` (this is where necessary
> node_modules from cordova-ios get copied). It would mean we would have to
> have a `package.json` be copied from `cordova-ios` into
> `MyCordovaProject/platforms/ios/cordova`. A cordova project would then at
> least have as many package.json files as platforms have been added. I think
> this is poor practice.
> Your usecase of npm linking modules in platforms (cordova-ios/node_modules)
> that then get copied into `MYCORDOVAPROJECT/platforms/ios/cordova` is
> unique. I still think the best solution is to add some sort of check to
> make sure you haven't npm linked or handle the npm linked case when
> copying. Guess this problem will arise more often with cordova-common. That
> usecase pretty much only affects cordova contributors.
> -Steve
> On Wed, Oct 28, 2015 at 1:18 PM, Dmitry Blotsky <>
> wrote:
>> Is it possible to do “npm install” in those directories instead? Or to
>> adjust the path so that require() works with the original node_modules
>> directory?
>> Kindly,
>> Dmitry
>>> On Oct 27, 2015, at 10:31 PM, Steven Gill <>
>> wrote:
>>> I don't think we thought of symlinks in this usecase. Probably worth
>> adding
>>> in code that checks for symlinks before the copy. I don't see us removing
>>> this copy as the cordova scripts (build, run, install, etc) require those
>>> modules.
>>> On Tue, Oct 27, 2015 at 9:24 PM, Dmitry Blotsky <>
>>> wrote:
>>>> Ping. Anyone have any information on this? Is it safe to "cp -r” a
>>>> node_modules directory?
>>>> Kindly,
>>>> Dmitry
>>>>> On Oct 26, 2015, at 3:06 PM, Dmitry Blotsky <>
>>>> wrote:
>>>>> Hey folks,
>>>>> I’ve come across a bug with symlinks and platform installation
>> recently.
>>>> The point of interest is this line:
>>>>> Is copying node_modules a safe operation? In my case there was a
>>>> relative symlink inside it when it was copied and as a result some
>>>> dependencies broke. The symlink was created by a previous invocation of
>>>> “npm link”.
>>>>> Kindly,
>>>>> Dmitry

View raw message