Closed p2kmgcl closed 3 years ago
Seems like a reasonable guess. In @liferay/npm-scripts
we use the dot-relative form and it works fine.
Just to clarify, @p2kmgcl — I see you tested this on Linux and Windows, but the linked LPS only mentions Windows. Does that mean it works on Linux and not on Windows?
Nope, I tested on Windows for the LPS and then I found that it doesn't work on Linux too (thanks to @izaera). I am going to update the Jira ticket :sweat_smile:
I'm getting a different error in Windows:
This has nothing to do with what I tried to fix in this PR, i.e.: it has a different solution. I need to make sure what is really happening: whether this is the real error, or if there are two different errors that need to be addressed separately.
Can you check again @p2kmgcl ?
The steps are:
yarn init
(yes to everything)yarn add -D generator-liferay-fragments@next
(which has @liferay/npm-bundler@3.0.1-pre.1
as dependency)npx @liferay/npm-bundler
Ok, after testing this on Windows, Linux, different computer and different npx
versions (6 and 7 to be precise) I think that npx
is more fragile than what I thought on the first place (too much magic :unicorn:). I just merged this change removing the npx
call and looking for the liferay-npm-bundler.js
file manually.
@izaera suggested replacing this path.resolve
with a require.resolve
to better find where the node_modules
directory is, but that's something I'll do tomorrow (because I'm tired).
Anyway, thanks @wincent and @izaera for your time and sorry for the npx
headache, I'm closing the issue.
:rainbow:
(because I'm tired).
Issue type
Description
(Linked Jira issue https://issues.liferay.com/browse/LPS-122795) (Reviewed with @izaera)
Desired behavior: call
@liferay/npm-bundler
withnpx
(npx @liferay/npm-bundler
).Current behavior: when the command is run, an error is shown in the console:
Repro instructions (if applicable):
Other information (environment, versions etc):
npx @angular/cli
and it works.