[
https://issues.apache.org/jira/browse/CB-13587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257049#comment-16257049
]
Lukas Plachy commented on CB-13587:
-----------------------------------
(copy from the original issue where it was out of place) Jan Piotrowski (Sujan)
added a comment - 2 days ago - edited
Yeah, you seem to be messing up some things in your rant here. The default
install location of npm on Windows is in Roaming. That's why nvm-windows
explicitly tells you to delete that in the README so it can move all future
installs to your chosen nvm install path.
The rest I didn't really understand (or read tbh). It works fine for me and the
hundreds of users it helped to solve npm foo in the last few months.
> nvm_cordova_create.png
If you just installed that node version, you shouldn't even be able to run
`cordova create` on the command line without installing it with `-g`, correct?
I tried to reproduce locally, couldn't even with @ in folder name:
PS C:\> cd foo
PS C:\foo> cordova create bar
Creating a new cordova project.
PS C:\foo> cd ..
PS C:\> cd .\@foo\
PS C:\@foo> cordova create bar
Creating a new cordova project.
PS C:\@foo>
Can you just try if `cordova create` works in a normal folder, with a normal
global Cordova install?
(copy from the original issue where it was out of place) rheingold Lukas Plachy
added a comment - Yesterday - edited
Well, well, well ... so we have the intermediate cause of this problem: When
installed in default paths, the whole thing works like a charm. See attached
screenshots (cordova_create_over_nvm_std_dirs.png and
cordova_create_direct_MSI_install_std_dirs.png), however they do not bring any
additional information.
So let me make an 'expert guess', just only as a small hint from my (bad)
experience: The error message string construction in the source code uses a
different 'base_path' variable (I do not know the exact name of the variable,
Im just guessing there must be such one) than the real command trying to copy
the file(s), which definitely uses some other construction or a different
'base_path' variable.
That is for me currently the final state of this ticket, Im afraid I cant help
you anymore. Of course I'll try to find some workaround and if succesfull, then
I'll append it here (and report to our sysadmins so that they are aware of the
risk of Roaming profile bloating out of controll), but the solution itself
remains most probably in the code, unless Im missing something else.
Thanks for cooperation and help so far and many thanks for the tip with the
default directories. Should I be able to help you with anything else or if any
detailed information shall be needed, do not hesitate to contact me through
this ticket or directly through my profile.
>>> Knowledge base addendum when trying to work with direct install from MSI
>>> and not the using nvm:
FOR ANYONE to whom it may concern when facing the issue (on Windows) that after
'npm install -g anything' the module being installed (if a CLI present) does
not work in CLI, please note following:
(cut for brevity, see the original post in CB-13536)
(copy from the original issue where it was out of place) Sujan12 Jan Piotrowski
(Sujan) added a comment - Yesterday
if you need to install some module "globally" but into a custom directory
This is not really how npm works. You can either install in a directory of your
choice, or globally with `-g` in whatever location npm uses for that. Command
line tools will (on Windows) only work if installed globally or some manual and
error prone workaround.
But did I get this right that it now works for your with a global installation
of Cordova?
(copy from the original issue where it was out of place) Lukas Plachy added a
comment - Yesterday - edited
Yes, when installing into default directories, then the 'cordova create
cordova' works ok
ad global installation .... what you are describing is not what I have
tested here ... the "global" instalation SHOULD mean, that the 'node_modules' +
their respective cmd scripts are installed in that directory, that is being
used as npm/nvm root directory for nodejs (typically C:\Program Files\nodejs).
HOWEVER when you use the "-g" argument, then npm or nodejs COMPLETLY
IGNORES(!!!) its settings from where it has been launched from, installed into
or has set into "%PATH%" and installs the module in question stubbornly into a
constant path C:\Users%CURRENTUSER%\AppData\Roaming\npm (or nvm\vX.X.X.
depending what installation type you have done).
If you setup a different path for nodejs during install (lets say
'D:\MYDIRECTORY\nodejs' to use in this example) then the install launched with
"-g" neglects this settings as well (an will use - from my point of view very
wrongfully - the C:\Users\....\Roaming\npm again). BUT a "-g" install is
nothing else, than doing
cd D:\MYDIRECTORY\nodejs (excuse the brevity, of course first there should be
the disk change 'd:' and then the cd)
and performing a "local" install
D:\MYDIRECTORY\nodejs>npm install some_package
which however has some side effects (such as installing/updating the npm itself
for example, which then is not able to recreate the commandline 'npm.cmd'
scripts since they are in use in that moment).
So when the "-g" argument ignores the root path it should install the modules
into and sticks to the "Roaming" directory, which definitely is NOT a place for
installing runtimes (even those which might be considered document
data/libraries source such as the *.js files used on the nodejs platform), then
one has to force the installation to happen where it belongs to (eg. the
desired "root" directory of nodejs as specified during the originating MSI or
NVM install).
(copy from the original issue where it was out of place) Jan Piotrowski (Sujan)
added a comment - Yesterday
I think you misunderstood how `-g` is supposed to work.
If you disagree, both node and npm have repositories on Github where you can
create an issue and discuss this with their maintainers. Thank you.
> cordova-create fail to copy template when forcibly installed in global nodejs
> modules
> -------------------------------------------------------------------------------------
>
> Key: CB-13587
> URL: https://issues.apache.org/jira/browse/CB-13587
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-create
> Reporter: Lukas Plachy
> Attachments: 2017-11-14T14_08_29_042Z-debug.log,
> cordova_create_cordova.png
>
>
> Hi, anybody an idea, whats wrong here (see attached image)? Such error does
> not help when doing first hands-on!
> Thanks
> 2017-11-14T14_08_29_042Z-debug.log
> cordova_create_cordova.png
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]