I’m setting up existing projects on a new Macbook. Thought it’s gonna be way simpler but am still fiddling with errors etc.
So: found https://roots.io/sage/docs/existing-sage-projects/ and should be simple, right?
I’m pulling the existing WP repo (using only Sage, no Bedrock, so just wp-content folder in GIT) then using wp-cli to pull in latest WP, then create config file via
wp config create and then I import DB from production and search-replace it and that’s that. Then I run
valet link to access the local dev url.
To get the theme up and running of course I follow the steps on Sage but when I get to
yarn command, I get the error
node_modules/node-sass: Command failed. Exit code: 1
Command: node scripts/build.js
Other stuff i noticed in there:
File “/Users/me/Documents/Dev/project-example/wp-content/themes/my-theme/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py”, line 1265, in XcodeVersion
gyp ERR! node -v v10.15.3
To explain further, I’m using wp valet cli to start new projects (in combination with other commands in a script and that usually worked flawlessly).
But now on a clean new macbook and when installing stuff anew (mostly using brew!) things are a mess and I hoped they won’t be. But there’s always an error when you least expect it and even when following some newby step-by-step it doesn’t do exactly what is says it should.
So what is the problem? Node / yarn / npm / php version combinations?
The error when I fixed the first one was then after
yarn start :
(node:29057) [ESLINT_LEGACY_OBJECT_REST_SPREAD] DeprecationWarning: The 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' option is deprecated. Use 'parserOptions.ecmaVersion' instead. (found in ".eslintrc.js")
And I copied the .eslintrc.js from the Roots github repo (before that the error was that the file does not exist:
Module build failed: Error: No ESLint configuration found.).
When I open the dev url, I see
https://code.jquery.com/jquery-1.12.4-wp.min.js net::ERR_ABORTED 404 (Not Found) and everything messed up because of it. I’m at a loss why everything is so messed up at this point.
On my old Mac everything works, but as far as I remember I had to play with all the versions/dependencies there as well. Why is this never simple? I can’t remember ever not having problems with npm/yarn/node etc
➜ ~ node -v
➜ ~ yarn -v
➜ ~ npm -v
➜ ~ composer --version
Composer version 1.8.5 2019-04-09 17:46:47
➜ ~ php -v
PHP 7.3.5 (cli) (built: May 2 2019 12:40:36) ( NTS )
Any help or making this procedure easier appreciated, I’m kind of losing my mind with WP dev right now . I seem like I’m following solutions online and fixing stuff and then something else breaks …
EDIT / solution
The main issue was as expected Node version. v10 didn’t play well so I used v8 (latest v8). Also I needed to copy .eslintrc.js file from github and then add some custom settings in it since it was not in our git repo.