WebDevStudios / wd_s

A starter theme from WebDevStudios.
https://wdunderscores.com
GNU General Public License v2.0
657 stars 138 forks source link

npm i fails for me on main branch #630

Closed salcode closed 3 years ago

salcode commented 3 years ago

I'm getting a failure when I run npm i using the main branch. I did first run nvm use, so I assume I'm on the correct versions of npm and node.

$ nvm use
Found '/Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/.nvmrc' with version <14>
Now using node v14.8.0 (npm v6.14.7)

$ npm i
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> wd_s@2.0.0 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s
> npm run build

> wd_s@2.0.0 build /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s
> wds-build && npm run theme

sh: wds-build: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! wd_s@2.0.0 build: `wds-build && npm run theme`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the wd_s@2.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sal/.npm/_logs/2021-04-14T19_23_54_150Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd_s@2.0.0 postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd_s@2.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sal/.npm/_logs/2021-04-14T19_23_54_228Z-debug.log
salcode commented 3 years ago

Here is a Gist with the output from /Users/sal/.npm/_logs/2021-04-14T19_23_54_228Z-debug.log

https://gist.github.com/salcode/37ec3dc0d4c6df021b341c99d2ee700f

gregrickaby commented 3 years ago

@salcode Could you please try again with npm i --legacy-peer-deps

salcode commented 3 years ago

Hmmm... still no dice (I'm on commit 8c1b986)

$ npm i --legacy-peer-deps
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> fsevents@1.2.13 install /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> core-js@2.6.12 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> core-js@3.10.0 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js-pure@3.10.0 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@2.6.12 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/wait-on/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> gifsicle@4.0.1 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/gifsicle
> node lib/install.js

  ✔ gifsicle pre-build test passed successfully

> jpegtran-bin@4.0.0 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/jpegtran-bin
> node lib/install.js

  ✔ jpegtran pre-build test passed successfully

> optipng-bin@5.1.0 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/optipng-bin
> node lib/install.js

  ✔ optipng pre-build test passed successfully

> pngquant-bin@5.0.2 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/pngquant-bin
> node lib/install.js

  ✔ pngquant pre-build test passed successfully

> @arkweid/lefthook@0.7.2 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/@arkweid/lefthook
> node postinstall.js

SYNCING lefthook.yml
SERVED HOOKS: pre-commit, prepare-commit-msg

> wd_s@2.0.2 postinstall /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s
> composer install --quiet && npm run build

> wd_s@2.0.2 build /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s
> cross-env NODE_ENV=production run-s build:*

> wd_s@2.0.2 build:pot /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s
> composer run-script pot

> wp i18n make-pot . build/languages/_s.pot --exclude=node_modules,vendor,build
Theme stylesheet detected.
Success: POT file successfully generated!

> wd_s@2.0.2 build:scripts /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s
> wp-scripts build --config webpack.prod.js

Hash: ca3a7b4e13ad98190245
Version: webpack 4.46.0
Time: 20754ms
Built at: 04/15/2021 4:34:01 PM
 14 assets
Entrypoint index = index.css index.js
[0] ./src/index.js 781 bytes {0} [built]
[1] ./src/scss/tailwind.scss 39 bytes {0} [built]
[2] ./src/scss/index.scss 39 bytes {0} [built]
    + 12 hidden modules

ERROR in Cannot find module 'prettier'
Require stack:
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/@eslint/eslintrc/lib/config-array-factory.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/@eslint/eslintrc/lib/index.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint/lib/cli-engine/cli-engine.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint/lib/cli-engine/index.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint/lib/api.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint-webpack-plugin/dist/getESLint.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint-webpack-plugin/dist/linter.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint-webpack-plugin/dist/index.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/eslint-webpack-plugin/dist/cjs.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/webpack.config.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/webpack.prod.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/webpack-cli/bin/utils/convert-argv.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/webpack-cli/bin/cli.js
- /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/node_modules/webpack/bin/webpack.js
Occurred while linting /Users/sal/code/wpgeneric/app/public/wp-content/themes/wd_s/src/index.js:4
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! wd_s@2.0.2 build:scripts: `wp-scripts build --config webpack.prod.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the wd_s@2.0.2 build:scripts script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sal/.npm/_logs/2021-04-15T20_34_01_567Z-debug.log
ERROR: "build:scripts" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd_s@2.0.2 build: `cross-env NODE_ENV=production run-s build:*`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd_s@2.0.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sal/.npm/_logs/2021-04-15T20_34_01_614Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd_s@2.0.2 postinstall: `composer install --quiet && npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd_s@2.0.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sal/.npm/_logs/2021-04-15T20_34_01_710Z-debug.log

Gist of /Users/sal/.npm/_logs/2021-04-15T20_34_01_710Z-debug.log

gregrickaby commented 3 years ago

🤔 Hrmmm I've traced this to an entry in webpack.config.js. On line 130 we're calling:

new ESLintPlugin()

Which is trying to use the real Prettier package, not the WordPress forked version we have installed. I fixed this by adding the following to package.json:

"prettier": "npm:@wordpress/prettier-config@*"

Thanks for flagging this, @salcode. Nice find!