Build WordPress from Source

Install node.js
# apt-get install node.js
Download WordPress Source code
# cd ~
# svn co wordpress-core
# cd wordpress-core
# npm install –save core-js@^3
# npm install -g grunt core-js@^3
# npm install -g grunt-cli core-js@^3
# npm install
# npm run build:dev
# npm run env:start
# npm run env:install
Then to stop the environment
# npm run env:stop
To run the WP-CLI tool see
# npm run env:cli
From WP-CLI can run lots of commands including tests
-For PHP Tests
# npm run test:php
-for E2E (end to end) Tests
# npm run test:e2e

Fix NPM errors
Error: Cannot find module ‘uglifyjs-webpack-plugin’
# npm install –save uglifyjs-webpack-plugin
WARN uglifyjs-webpack-plugin@2.2.0 requires a peer of webpack@^4.0.0 but none was installed.
#npm install –save webpack@^4

# wget
Then, check if it works:
# php wp-cli.phar –info
To be able to type just wp, instead of php wp-cli.phar, you need to make the file executable and move it to somewhere in your PATH. For example:
# chmod +x wp-cli.phar
# mv wp-cli.phar /usr/local/bin/wp
Now try running
# wp –info

From Slack Making WordPress Core Channel
Message #core
Mar 25th at 11:39 PM
Does npm run build not copy the js files?
Mar 25th at 11:40 PM
I usually run grunt build, which I think does. If it’s set to use the build directory for JS (I think that’s the same as npm run build?)
Mar 25th at 11:40 PM
Yeah npm run build / grunt build / npm run watch / grunt watch should all copy things from src to build (whereas npm run build:dev / grunt build –dev / npm run dev / grunt watch –dev all build from src into src )

Leave a Reply

Your email address will not be published. Required fields are marked *