Closed begrafx closed 3 years ago
@begrafx Hello,
I'm not sure is best solution but you may install module libnpx globally... npm install -g libnpx
@marceldobrica I tried that (look at the very end of my message). It says it already exists. --
Edit/correction mid-thought --
I had installed NPX, globally, which I would have presumed would have included the library (libnpx), however, in the name of full disclosure, I ran the install for LIBNPX specifically, and immediately after, I also did an npm init yo license
command. Following that, I attempted to run the generator again, and it worked.
I'm unclear why the libnpx
needed to be installed separately.
@begrafx.... libnpx was already installed but in a different location... I have seen something about that on internet.... I think it depends also on operating system.... ubuntu and nvm....
I'm using MacOS, but I'll look for that. Glad I got it working at any rate. Thank you.
OK... to add to/continue on this, I had done the Global install of LIBNPX (npm install -g libnpx) and it worked, so I thought I was good. The Mediacurrent YouTube video I was watching about the Theme Generator, however shows that the theme should have a Patternlab folder, which it does not. After a few attempts, I thought I would try a fresh setup, now that I thought I had everything working. So I generated a new theme, I noticed that the Patternlab folder was still missing; but I thought perhaps it was installed/created when the Gulp process was run, so I started the process:
`$ npm run watch
newtheme@1.0.0 watch gulp watch
Pattern Lab Node v5.14.1 Pattern Engine mustache: good to go Pattern Engine twig-php: good to go Found uikit package @pattern-lab/uikit-workshop Please update the configuration of UIKit uikit-workshop with property 'package: @pattern-lab/uikit-workshop' in patternlab-config.json. Lookup by 'name' is deprecated and will be removed in the future. TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
ERROR: missing an essential file from /[PATH]/web/themes/custom/newtheme/node_modules/@pattern-lab/uikit-workshop[object Object]. Pattern Lab won't work without this file.`
Still trying to sort out the problem...
Sorry, I had 30 things going at once as I wrote the last one. While I had installed LIBNPX globally the first time, when I attempted the second run, I got the same error, which was again resolved by running the installation of libnpx again, and after the installation it worked.
I'm unclear why the repeat installation is necessary, or why PatternLab isn't installing.
On my computer, ubuntu 20, nvm, I have same problem....uikit-workshop....for moment I didn't find any solution....I have seen something on internet about pattern-lab/uikit-workshop... it seams we are not the only ones...but no solution for moment...."update the configuration of...." node always says what you have to do.... but it will take some time for understand ...in fact that is only a deprecation message... the error is that "missing an essential file from ..."... and here is not so clear ...
Yes, that does sound like similar issue. We'll have to keep digging, see if we can find a fix, or at least a workaround.
@begrafx .... I have found the problem... is patternlab-config.json. I have to install Patternlab to understand....
now patternSectionSubtype is patternSectionSubgroup...
"patternlabFiles": { "general-header": "views/partials/general-header.mustache", "general-footer": "views/partials/general-footer.mustache", "patternSection": "views/partials/patternSection.mustache", "patternSectionSubgroup": "views/partials/patternSectionSubgroup.mustache", "viewall": "views/viewall.mustache" },
... and you may also change uikits in config with new patternlab version (to solve deprecation message):
"uikits": [ { "name": "uikit-workshop", "package": "@pattern-lab/uikit-workshop", "outputDir": "", "enabled": true, "excludedPatternStates": [], "excludedTags": [] } ],
@begrafx ... @mariohernandez (for last commit in README and help to review the solution) Now to work, what I do: nvm install 14.16.0 && node -v > .nvmrc npm create yo mc-d8-theme CHANGE patternlab-config.json as mentioned above .... AND VOILA! Have a nice time! Than.. npm run build... etc.
I have verified and solution works also on node 15.11.0.... but still problem with libnpx... and now some problems with content-type.... /patternlab/css/style.css?1615542528691” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)...
Regarding the "PatternSection..." fix you mention, mine reads
"patternSectionSubtype": "views/partials/patternSectionSubtype.mustache",
Am I understanding you correctly, I need to change "Subtype" to "Subgroup" as part of the fix?
I appreciate your assistance in getting this sorted out.
@mariohernandez Do we need to put together a patch for this?
@begrafx Yes you have understood correct. ... also uikit section...but probably you have already tried ... but still doesn't work smooth... mime type... still to learn and test...
OK... that appears to have worked. Let me dabble with it a bit more, before I make that a "for sure" statement...
@begrafx ... to work you should change content of _head.twig from src/styleguide/meta with _00-head.twig and _foot.twig with _01.foot.twig, in same directory. I really think it should be mentioned in README....
Let me repeat this back, make sure I am understanding what you said correctly.
I should copy what is in _00-head.twig into the _head.twig file, and the content of _01-foot.twig into _foot.twig?
Is that correct?
@begrafx ... Yes. For better understanding how and why you have to install and test Patternlab node (https://github.com/pattern-lab/patternlab-node)... Best regards.
OK, it looks like it's all good. The only other thing that I see that needs to happen is add
core_version_requirement: ^8 || ^9
to the THEMENAME.info.yml file, below
core: 8.x
so that your theme will be compatible with Drupal 9 as well.
@marceldobrica have you found anything else?
@begrafx You should also look on _foot.twig... it should contain relevant js files for Drupal 9 which are different from Drupal 8.... so is difficult to say ^8 || ^9....Probably a decision minimum of both....and more info on README ....
@mariohernandez - I will see what I can do to make that happen.
@marceldobrica - I'm looking at the _toot.twig file, I'm not seeing anything that immediately strikes as anything between D8 and D9. I do know that I have a Drupal 9 site that I use to test this with, and when the Generator originally creates the theme, the THEMENAME.info.yml contains only
core: 8.x
And D9 will see the theme, but won't allow you to install/activate it, as it is not a Drupal 9 theme. When I add the
core_version_requirement: ^8 || ^9
and save, and refresh, all is good, everything works.
@begrafx ... core/vendor/domready exists in Drupal 8 and don't exists in Drupal 9.... probably might be excluded from both ... I didn't verified if it is used in some components...
Thank you @marceldobrica and @begrafx for your feedback and great help. We are addressing most of the bugs you have reported and hope to have all those things addressed soon. Thank you again.
Closing this issue with the following updates:
npm install libnpx -g
)v14.16.1
. core_version_requirement: ^8 || ^9
as well as namespaces new format per components module requirements.Thank you @marceldobrica and @begrafx for the contributions. 🙌
I have attempted to install the theme generator, per the instructions in the docs. Here is the result.
`$ nvm install 12.10.0 && node -v > .nvmrc v12.10.0 is already installed. Now using node v12.10.0 (npm v7.6.2) Brians-Mac-mini:mytheme brianeller-mini$ nvm install-latest-npm Attempting to upgrade to the latest working version of npm...
npm
; if this does not work on your node version, please report a bug!changed 14 packages, and audited 254 packages in 14s
11 packages are looking for funding run
npm fund
for detailsfound 0 vulnerabilities
Error: Cannot find module 'libnpx' Require stack:
npm ERR! A complete log of this run can be found in: npm ERR! /Users/brianeller-mini/.npm/_logs/2021-03-10T14_10_13_767Z-debug.log`
After receiving this error the first time, I did a google search on "Error: Cannot find module 'libnpx' " and found a link on NPMs site, to install NPX. Here is the result of that:
`$ npm install -g npx npm ERR! code EEXIST npm ERR! path /Users/brianeller-mini/.nvm/versions/node/v12.10.0/bin/npx npm ERR! EEXIST: file already exists npm ERR! File exists: /Users/brianeller-mini/.nvm/versions/node/v12.10.0/bin/npx npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/brianeller-mini/.npm/_logs/2021-03-10T13_44_45_640Z-debug.log`
I'm sure I'm missing something completely obvious, but following Mediacurrent's documentation, I seem to have reached a point where following their steps yields this same result each time. So I will speak up, and ask for help.
Thank you.