Closed benhalverson closed 7 years ago
First up, thanks for helping us test the CLI. It's important for more 👀 to get on it.
I did some testing too.
I cannot even run patternlab -h
in a new directory. I would expect that to be able to output the help at least.
If I cd
to a directory that has an edition setup within it, patternlab -h
does work. So it seems to me that in both cases of failure, the CLI is expecting some structure to exist... but how much?
...
more testing
...
okay, so I added a node_modules/
directory in the folder I was testing within and now patternlab -h
works. Can we add that if not found?
and @benhalverson can you try adding node_modules/
and then run init
again?
Heres the new error for patterlab init
Loading engines from the edition or test directory...
/Users/benhalverson/.nvm/versions/node/v7.4.0/lib/node_modules/patternlab-node-cli/node_modules/patternlab-node/core/lib/pattern_engines.js:85
throw new Error('No engines loaded! Something is seriously wrong.');
^
Error: No engines loaded! Something is seriously wrong.
at loadAllEngines (/Users/benhalverson/.nvm/versions/node/v7.4.0/lib/node_modules/patternlab-node-cli/node_modules/patternlab-node/core/lib/pattern_engines.js:85:11)
at Object.<anonymous> (/Users/benhalverson/.nvm/versions/node/v7.4.0/lib/node_modules/patternlab-node-cli/node_modules/patternlab-node/core/lib/pattern_engines.js:183:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/benhalverson/.nvm/versions/node/v7.4.0/lib/node_modules/patternlab-node-cli/node_modules/patternlab-node/core/lib/object_factory.js:3:22)```
@bmuenzenmeyer Here are the workaround steps
A ha! thanks for the additional troubleshooting.
npm i -s pattern-lab/patternlab-node-cli
Interesting that you have to install the cli locally in order for it to work. My theory with the previous stack trace was that pattern_engines was failing because it could not find the default mustache pattern engine, which was installed along with the cli and core library in your global locations, rather than the current working directory
@benhalverson @bmuenzenmeyer Thanks for the report.Can we create a minimal test case for this.
From what I read is that you install the cli globally and then try to run patternlab init
it in a project dir, correct?
Okay, I was able to reproduce the error:
patternlab --help
This is a bug.
Okay, so far what I get from looking into the issues around global cli is that the core's postinstall isn't run for me after installing the cli.
When I try to manually run the core's postinstall from the global cli I get:
→ patternlab-node: node core/scripts/postinstall.js
Beginning Pattern Lab postinstall...
No starterkits found to automatically load.
@bmuenzenmeyer any ideas?
No engines loaded! Something is seriously wrong
it's failing because pattern_engines is not looking for potentially globally installed engines. We need to research how to look for globally installed packages. Or does require()
just degrade to that?
....
doing some quick research, it seems that expecting modules to be installed globally is not a good idea, and it's best to put your dependencies into the local node_modules/
whenever possible.
Does this fundamentally change the CLI then, or am I misreading something?
doing some quick research, it seems that expecting modules to be installed globally is not a good idea, and it's best to put your dependencies into the local node_modules/ whenever possible.
What do you refer to by dependencies
?
Does this fundamentally change the CLI then, or am I misreading something?
I do not think so :-) CLI is should be pretty agnostic for such things.
it's failing because pattern_engines is not looking for potentially globally installed engines. We need to research how to look for globally installed packages. Or does require() just degrade to that?
AFAIK require
resolves only to your package's local node_modules which is good. Except you pointing NODE_PATH
to your global node_modules
.
Closing as this is a won't fix for global installs until we hit #32
this should be in readme.md
@leualemax You are right. Thanks for pointing it out.
General information
patternlab init throws an error OSX version 10.10.5
Problem description
After running patternlab init I get the following error: