该项目的Github:https://github.com/postlight/headless-wp-starter
我正在尝试使用WSL在Windows机器上设置无头入门套件。但是,当我运行yarn install命令时,总是会卡住,在终端中出现以下错误。
`mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[Exec] Exit code 1 Time 0.571s
[Exec] Running mysql -uroot -proot -h 0.0.0.0 -e 'create database if not exists wp_headless'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[Exec] Exit code 1 Time 0.566s
[Exec] Running mysql -uroot -proot -h 0.0.0.0 -e "grant all privileges on wp_headless.* to wp_headless@localhost"
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[Exec] Exit code 1 Time 0.557s
[Exec] Running mysql -uroot -proot -h 0.0.0.0 -e 'flush privileges'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[Exec] Exit code 1 Time 0.623s
[Exec] Running wp --allow-root core download --version=4.9.7 --locale=en_US --force in /mnt/c/projects/headless/wordpress
Downloading WordPress 4.9.7 (en_US)...
Using cached file '/home/efk/.wp-cli/cache/core/wordpress-4.9.7-en_US.tar.gz'...
Success: WordPress downloaded.
[Exec] Done in 7.561s
[Exec] Running rm wordpress/wp-config.php > /dev/null 2>&1 ||
true
[Exec] Done in 0.52s
[Exec] Running wp --allow-root core config --dbname=wp_headless --dbuser=wp_headless --dbpass=wp_headless --dbhost=0.0.0.0 in /mnt/c/projects/headless/wordpress
ERROR 1045 (28000): Access denied for user 'wp_headless'@'localhost' (using password: YES)
[Exec] Exit code 1 Time 1.512s
[Exec] Running wp --allow-root db drop --yes in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.797s
[Exec] Running wp --allow-root db create in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.765s
[Exec] Running wp --allow-root core install --url=localhost:8080 --title="Postlight Headless WP Starter" --admin_user="nedstark" --admin_password="winteriscoming" --admin_email="nedstark@headlesswpstarter.dev" --skip-email in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.775s
[Exec] Running wp --allow-root theme activate postlight-headless-wp in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.778s
[Exec] Running wp --allow-root theme delete twentyfourteen in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.782s
[Exec] Running wp --allow-root theme delete twentyfifteen in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.771s
[Exec] Running wp --allow-root theme delete twentysixteen in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 38.933s
[Exec] Running wp --allow-root theme delete twentyseventeen in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.8s
[Exec] Running wp --allow-root plugin delete akismet in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.766s
[Exec] Running wp --allow-root plugin delete hello in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.784s
[Exec] Running wp --allow-root plugin activate acf-to-wp-api advanced-custom-fields-pro akismet custom-post-type-ui wp-graphql wp-migrate-db-pro wp-migrate-db-pro-cli wp-migrate-db-pro-media-files wp-rest-api-v2-menus in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.753s
[Exec] Running wp --allow-root acf sync in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.765s
[Exec] Running wp --allow-root rewrite structure "/%year%/%monthnum%/%day%/%postname%/" in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.776s
[Exec] Running wp --allow-root option update blogdescription "Just another (headless) WordPress site by your friends at Postlight" in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.745s
[Exec] Running wp --allow-root post update 1 wp-content/themes/postlight-headless-wp/post-content/sample-post.txt --post_title="Sample Post" --post_name=sample-post in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.75s
[Exec] Running wp --allow-root post create wp-content/themes/postlight-headless-wp/post-content/welcome.txt --post_type=page --post_status=publish --post_name=welcome --post_title="Congratulations!" in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.769s
[Exec] Running wp --allow-root term update category 1 --name="Sample Category" in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.758s
[Exec] Running wp --allow-root menu create "Header Menu" in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.78s
[Exec] Running wp --allow-root menu item add-post header-menu 1 in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.769s
[Exec] Running wp --allow-root menu item add-post header-menu 2 in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.782s
[Exec] Running wp --allow-root menu item add-term header-menu category 1 in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.902s
[Exec] Running wp --allow-root menu item add-custom header-menu "Read about the Starter Kit on Medium" https://trackchanges.postlight.com/introducing-postlights-wordpress-react-starter-kit-a61e2633c48c in /mnt/c/projects/headless/wordpress
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 0.819s
[Exec] Running wp --allow-root menu location assign header-menu header-menu in /mnt/c/projects/headless/wordpress
Err
or: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
[Exec] Exit code 1 Time 1.134s
[OK] Great. You can now log into WordPress at: http://localhost:8080/wp-admin (nedstark/winteriscoming)
Done in 101.52s.`
我尝试了使用自述文件中的各种方法来修复它,但似乎没有帮助。在运行此程序之前,我的计算机上没有mysql,所以看起来很奇怪。
你们有什么线索吗?
用于Windows的安装指南非常麻烦且难以弄清,因为它只是真正解释了几个步骤。
还有其他人遇到这些问题并弄清楚了吗?谢谢!
答案 0 :(得分:0)
您可能必须运行一些升级。更具体地说,对我而言,此修复就像运行yarn upgrade
一样容易。这应该可以解决您的问题,因为WSL与旧版软件包存在一些兼容性问题。