mediacurrent / theme_generator_8

Yeoman generator for Drupal Themes - lets you quickly set up a Drupal 8 theme with sensible defaults and best practices.
MIT License
100 stars 25 forks source link

Doesn't work with node 17 / npm 8? #124

Open damienmckenna opened 2 years ago

damienmckenna commented 2 years ago

I followed Mario's getting started guide and it resulted in the site using node 17.0.1 and npm 8.1.0. When I then run npm create yo mc-d8-theme it results in the following:

$ npm create yo mc-d8-theme
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'libnpx'
Require stack:
- /Users/me/.nvm/versions/node/v17.0.1/lib/node_modules/npm/noop.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at resolveFileName (/Users/me/.npm/_npx/695c49aed3c9f0d7/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/Users/me/.npm/_npx/695c49aed3c9f0d7/node_modules/resolve-from/index.js:43:9)
    at module.exports (/Users/me/.npm/_npx/695c49aed3c9f0d7/node_modules/resolve-from/index.js:46:47)
    at module.exports (/Users/me/.npm/_npx/695c49aed3c9f0d7/node_modules/import-from/index.js:4:55)
    at Object.<anonymous> (/Users/me/.npm/_npx/695c49aed3c9f0d7/node_modules/create-yo/src/create-yo.js:8:13)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/me/.nvm/versions/node/v17.0.1/lib/node_modules/npm/noop.js'
  ]
}

Node.js v17.0.1
npm ERR! code 1
npm ERR! path /Users/me/Documents/mysite/web/themes/my_theme
npm ERR! command failed
npm ERR! command sh -c create-yo "mc-d8-theme"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2021-10-25T15_26_37_478Z-debug.log
damienmckenna commented 2 years ago

Here are the contents of the log file: 0 verbose cli [ 0 verbose cli '/Users/me/.nvm/versions/node/v17.0.1/bin/node', 0 verbose cli '/Users/me/.nvm/versions/node/v17.0.1/bin/npm', 0 verbose cli 'create', 0 verbose cli 'yo', 0 verbose cli 'mc-d8-theme' 0 verbose cli ] 1 info using npm@8.1.0 2 info using node@v17.0.1 3 timing npm:load:whichnode Completed in 0ms 4 timing config:load:defaults Completed in 2ms 5 timing config:load:file:/Users/me/.nvm/versions/node/v17.0.1/lib/node_modules/npm/npmrc Completed in 1ms 6 timing config:load:builtin Completed in 1ms 7 timing config:load:cli Completed in 1ms 8 timing config:load:env Completed in 0ms 9 timing config:load:file:/Users/me/Documents/mysite/web/themes/my_theme/.npmrc Completed in 0ms 10 timing config:load:project Completed in 2ms 11 timing config:load:file:/Users/me/.npmrc Completed in 1ms 12 timing config:load:user Completed in 2ms 13 timing config:load:file:/Users/me/.nvm/versions/node/v17.0.1/etc/npmrc Completed in 0ms 14 timing config:load:global Completed in 0ms 15 timing config:load:validate Completed in 0ms 16 timing config:load:credentials Completed in 2ms 17 timing config:load:setEnvs Completed in 1ms 18 timing config:load Completed in 11ms 19 timing npm:load:configload Completed in 11ms 20 timing npm:load:setTitle Completed in 18ms 21 timing npm:load:setupLog Completed in 0ms 22 timing config:load:flatten Completed in 2ms 23 timing npm:load:cleanupLog Completed in 2ms 24 timing npm:load:configScope Completed in 0ms 25 timing npm:load:projectScope Completed in 0ms 26 timing npm:load Completed in 34ms 27 http fetch GET 200 https://registry.npmjs.org/create-yo 646ms (cache revalidated) 28 timing arborist:ctor Completed in 0ms 29 timing arborist:ctor Completed in 0ms 30 timing arborist:ctor Completed in 0ms 31 timing command:init Completed in 759ms 32 verbose stack Error: command failed 32 verbose stack at ChildProcess. (/Users/me/.nvm/versions/node/v17.0.1/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27) 32 verbose stack at ChildProcess.emit (node:events:390:28) 32 verbose stack at maybeClose (node:internal/child_process:1062:16) 32 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) 33 verbose cwd /Users/me/Documents/mysite/web/themes/my_theme 34 verbose Darwin 19.6.0 35 verbose argv "/Users/me/.nvm/versions/node/v17.0.1/bin/node" "/Users/me/.nvm/versions/node/v17.0.1/bin/npm" "create" "yo" "mc-d8-theme" 36 verbose node v17.0.1 37 verbose npm v8.1.0 38 error code 1 39 error path /Users/me/Documents/mysite/web/themes/my_theme 40 error command failed 41 error command sh -c create-yo "mc-d8-theme" 42 verbose exit 1

damienmckenna commented 2 years ago

I created #125 to hopefully resolve this problem, though I haven't tested it yet.

damienmckenna commented 2 years ago

It seems that running npm add libnpx -g lets it run Yeoman with the global tool.

damienmckenna commented 2 years ago

I can confirm that even after running 'npm install @pattern-lab/core, whilenpm run build` works without any errors there is no styleguide available.

damienmckenna commented 2 years ago

FYI when you follow the current instructions to use node 14.6.1 you end up with some security problems in the dependencies tree:

found 40 vulnerabilities (23 moderate, 17 high)
run `npm audit fix` to fix them, or `npm audit` for details

There are also a bunch of warnings:

npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN gulp-stylelint@11.0.0 requires a peer of stylelint@^10.1.0 || ^11.0.0 || ^12.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gulp-stylelint@11.0.0 requires a peer of stylelint@^10.1.0 || ^11.0.0 || ^12.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-autosuggest@9.4.3 requires a peer of react@>=0.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN react-dom@16.14.0 requires a peer of react@^16.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-html-parser@2.0.2 requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN redux-thunk@2.4.0 requires a peer of redux@^4 but none is installed. You must install peer dependencies yourself.
npm WARN @reach/visually-hidden@0.1.4 requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-autowhatever@10.2.1 requires a peer of react@>=0.14.7 but none is installed. You must install peer dependencies yourself.