Make WordPress Core

Opened 2 years ago

Closed 21 months ago

Last modified 9 months ago

#56725 closed defect (bug) (worksforme)

WordPress setup on local - "npm run env:install" not working on windows

Reported by: ashokrd2013's profile ashokrd2013 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: reporter-feedback close
Focuses: Cc:

Description

Platform

  • Windows 10 OS
  • Docker
  • Node & NPM

Steps to reproduce:

  1. Cloned WP develop repo using git clone https://github.com/WordPress/wordpress-develop.git & followed README
  1. Navigate to the cloned directory - cd wp-develop
  1. Installed npm dependencies for the project - npm install
  1. Executed other commands - npm run build:dev & npm run env:start
  1. While running the - npm run env:install gives me an error that WP_CLI can't create a config file at the root.

I looked out for a solution - finding one reply regarding the permission issue seems to be convincing, however, doesn't give any solution/steps to fix it.

Attachments (1)

Screenshot_21.png (97.2 KB) - added by ashokrd2013 2 years ago.
Error description

Download all attachments as: .zip

Change History (15)

#1 @ashokrd2013
2 years ago

  • Severity changed from normal to major

#2 @mukesh27
2 years ago

  • Severity changed from major to normal
  • Version trunk deleted

#3 @ashokrd2013
2 years ago

More details of the error:

Execution of the command > npm run env:install

WordPress@6.1.0 env:install D:\wamp64\www\wordpress-develop
node ./tools/local-env/scripts/install.js

Creating wordpress-develop_cli_run ... done
Success: Generated 'wp-config.php' file.
Creating wordpress-develop_cli_run ... done
Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'.
Creating wordpress-develop_cli_run ... done
Success: Added the constant 'WP_DEBUG_LOG' to the 'wp-config.php' file with the raw value 'true'.
Creating wordpress-develop_cli_run ... done
Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file with the raw value 'true'.
Creating wordpress-develop_cli_run ... done
Success: Added the constant 'SCRIPT_DEBUG' to the 'wp-config.php' file with the raw value 'true'.
Creating wordpress-develop_cli_run ... done
Success: Added the constant 'WP_ENVIRONMENT_TYPE' to the 'wp-config.php' file with the value 'local'.
Cloning into 'tests/phpunit/data/plugins/wordpress-importer'...
Creating wordpress-develop_cli_run ... done

Warning: file_get_contents(/var/www/src/wp-config.php): failed to open stream: No such file or directory in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 654
Error: Strange wp-config.php file: wp-settings.php is not loaded directly.
ERROR: 1
(node:10148) UnhandledPromiseRejectionWarning: Error: Command failed: docker-compose run --rm cli db reset --yes

at checkExecSyncError (child_process.js:790:11)
at execSync (child_process.js:863:15)
at wp_cli (D:\wamp64\www\wordpress-develop\tools\local-env\scripts\install.js:48:2)
at D:\wamp64\www\wordpress-develop\tools\local-env\scripts\install.js:38:3
at processTicksAndRejections (internal/process/task_queues.js:95:5)

(Use node --trace-warnings ... to show where the warning was created)
(node:10148) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without
a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10148) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@ashokrd2013
2 years ago

Error description

This ticket was mentioned in Slack in #core-test by ashokrd2013. View the logs.


2 years ago

This ticket was mentioned in Slack in #core-test by ashokrd2013. View the logs.


22 months ago

#6 @bgoewert
22 months ago

  • Keywords reporter-feedback added

@ashokrd2013 I was not able to reproduce this. Can you please provide some more details about your environment/platform? If the issue still occurs for you, I would suggest that you update all aspects of your environment/platform.

Reproduction Report

This report validates that the issue cannot be reproduced.

Environment

  • OS: Windows 10 Home Build 19045
  • Web Server: Docker Desktop v4.15.0 (Docker Engine v20.10.21)
  • PHP: 7.4.33
  • WordPress: trunk
  • Browser: N/A
  • Theme: N/A
  • Active Plugins: N/A
  • Composer v2.5.1
  • NVM for Windows v1.1.10
  • Node v14.21.2
  • NPM v6.14.17

Actual Results

  • ❌ Error condition does not occur (unable to reproduce).
Last edited 22 months ago by bgoewert (previous) (diff)

#7 @bgoewert
22 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Marking as invalid as a result of the reproduction report on comment:6 unless someone else is able to reproduce this on Windows.

Edit: should have marked as worksforme. See ticket properties. Now I know.

Last edited 22 months ago by bgoewert (previous) (diff)

#8 @ashokrd2013
22 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

@bgoewert

I can reproduce it with following Reproduction Report

Environment


OS: Windows 10 Pro Build 19044.2364
Web Server: Docker Desktop v4.15.0 (Docker Engine v20.10.21)
PHP: 7.4.33
WordPress: trunk
Browser: N/A
Theme: N/A
Active Plugins: N/A
Composer v2.5.1
NVM for Windows v1.1.9
Node v14.21.1
NPM v6.14.17

#9 @bgoewert
22 months ago

@ashokrd2013 It seems that this is a configuration issue, not an issue with wordpress-develop and would have been better posted to wordpress.org/support. But I don't mind to help out here.

Questions

  1. Are you using WSL2 or Hyper-V backend?
  2. Is your user a local admin and/or in the docker-users group?
    • You can check it by using net localgroup docker-users
    • If not, you can add it with net localgroup docker-users <user> /add
  3. Are you using WAMP? D:\wamp64\www\ I noticed this in your path and it may be causing permission issues (idk, I don't use wamp or xampp so I don't know how the permissions work for them). However, I imagine it would still work if your user was a local admin.
    • Just for testing purposes, try cloning wordpress-develop into a different directory on your C:\ drive.

Steps I just tested again, without issue

  1. Clone wordpress-develop
  2. cd wordpress-develop
  3. npm install
  4. npm run env:reset
  5. npm build:dev
  6. npm run env:start
  7. Navigate to localhost:8889, notice that I am redirected to /wp-admin/install.php.
  8. npm run env:install
  9. Navigate to localhost:8889/wp-admin/install.php, notice it says "Already Installed".
PS C:\Users\goewe\Desktop\Projects\WordPress\wordpress-develop> npm run env:install

> WordPress@6.2.0 env:install C:\Users\goewe\Desktop\Projects\WordPress\wordpress-develop
> node ./tools/local-env/scripts/install.js

[+] Running 21/21
 - cli Pulled                                                                                                      2.8s
   - a603fa5e3b41 Already exists                                                                                   0.0s
   - c428f1a49423 Already exists                                                                                   0.0s
   - 156740b07ef8 Already exists                                                                                   0.0s
   - fb5a4c8af82f Already exists                                                                                   0.0s
   - 972155ae644b Already exists                                                                                   0.0s
   - a8e3b94fe6c1 Already exists                                                                                   0.0s
   - 93346a3f46bc Already exists                                                                                   0.0s
   - b922b67ca46b Already exists                                                                                   0.0s
   - 6137f893bda6 Already exists                                                                                   0.0s
   - 79b1a1b78461 Already exists                                                                                   0.0s
   - 604120b01061 Already exists                                                                                   0.0s
   - f6495f637592 Already exists                                                                                   0.0s
   - 6d9f5157501d Already exists                                                                                   0.0s
   - a830bd0550f2 Already exists                                                                                   0.0s
   - 1703f3d8599c Already exists                                                                                   0.0s
   - e483604ead07 Already exists                                                                                   0.0s
   - c9a9ff052dd9 Pull complete                                                                                    1.2s
   - fb5e5b5906eb Pull complete                                                                                    1.3s
   - ded9eeca1440 Pull complete                                                                                    1.4s
   - cb8e7b039c8e Pull complete                                                                                    1.5s
Success: Generated 'wp-config.php' file.
Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'.
Success: Added the constant 'WP_DEBUG_LOG' to the 'wp-config.php' file with the raw value 'true'.
Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file with the raw value 'true'.
Success: Added the constant 'SCRIPT_DEBUG' to the 'wp-config.php' file with the raw value 'true'.
Success: Added the constant 'WP_ENVIRONMENT_TYPE' to the 'wp-config.php' file with the value 'local'.
Cloning into 'tests/phpunit/data/plugins/wordpress-importer'...
Success: Database reset.
Success: WordPress installed successfully.

#10 @bgoewert
22 months ago

@ashokrd2013 Just wanted to follow up to see if you could provide some answers to the questions in comment:9.


As an aside, I'd also would like to note that I am having a similar, if not the same, permission issue on Linux (Pop!_OS) while trying to use env:install. However, I believe that this can be addressed by using sudo. Although if you are like me and have nvm installed, this is in the user context. To use the nvm version of npm with sudo, you'd have to create a symlink some other method of sharing ~/.nvm.

Edit: Solved by changing the entire wordpress-develop directory permissions to 777.

Last edited 22 months ago by bgoewert (previous) (diff)

#11 @ashokrd2013
21 months ago

  • Keywords close added
  • Resolution set to worksforme
  • Status changed from reopened to closed

@bgoewert Thanks for helping me to provide different options to solve this issue.

I got it solved on another machine. I am unsure that either it will be a permission issue or something else, however, I got my problem solved.

This ticket was mentioned in Slack in #core by mrinal. View the logs.


16 months ago

#14 @swissspidy
9 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.