#56725 closed defect (bug) (worksforme)
WordPress setup on local - "npm run env:install" not working on windows
Reported by: | 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:
- Cloned WP develop repo using git clone https://github.com/WordPress/wordpress-develop.git & followed README
- Navigate to the cloned directory -
cd wp-develop
- Installed npm dependencies for the project -
npm install
- Executed other commands -
npm run build:dev
&npm run env:start
- 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)
Change History (15)
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.
2 years ago
#6
@
2 years 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).
#7
@
2 years 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.
#8
@
2 years 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
@
2 years 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
- Are you using WSL2 or Hyper-V backend?
- 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
- You can check it by using
- 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.
- Just for testing purposes, try cloning wordpress-develop into a different directory on your
Steps I just tested again, without issue
- Clone wordpress-develop
cd wordpress-develop
npm install
npm run env:reset
npm build:dev
npm run env:start
- Navigate to localhost:8889, notice that I am redirected to
/wp-admin/install.php
. npm run env:install
- 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
@
2 years 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.
#11
@
2 years 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.
#12
@
18 months ago
I am facing a similar issue, https://wordpress.slack.com/files/U0HQW02SZ/F05BHDF2AUX/image.png
OS: Windows 10
More details of the error:
Execution of the command > npm run env:install
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
(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.