WordPress / theme-review-action

Other
32 stars 10 forks source link

Can not run locally on Windows 10 #18

Open carolinan opened 3 years ago

carolinan commented 3 years ago

I am unable to use npm run start locally on Windows 10:

Steps:
- Copying theme files into the environment...Error: Cannot copy '.' to a subdirectory of itself, 'D:\wpreviewaction\theme-review-action\test-theme'.
× Copying theme files into the environment...
√ Checking theme's basic structure

\ Setting up the development environment for testing...Error: Command failed with exit code 1: npm run install:environment
✖ EPERM: operation not permitted, rename 'C:\Users\Carolina\.wp-env\016297c788c93c3297970932e19a5611\theme-check.temp\theme-check' -> 'C:\Users\Carolina\.wp-env\016297c788c93c3297970932e19a5611\theme-check'
[Error: EPERM: operation not permitted, rename 'C:\Users\Carolina\.wp-env\016297c788c93c3297970932e19a5611\theme-check.temp\theme-check' -> 'C:\Users\Carolina\.wp-env\016297c788c93c3297970932e19a5611\theme-check'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'rename',
  path: 'C:\\Users\\Carolina\\.wp-env\\016297c788c93c3297970932e19a5611\\theme-check.temp\\theme-check',
  dest: 'C:\\Users\\Carolina\\.wp-env\\016297c788c93c3297970932e19a5611\\theme-check'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wordpress-theme-check-action@1.4.5 wp-env: `wp-env "start"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wordpress-theme-check-action@1.4.5 wp-env script.

Node.js v12.18.3. NPM 6.14.11 Command prompt as administrator. Docker 3.1.0 (51484)

So far I have tried:

  1. Confirmed that my user does have full control to modify the .wp-env folder and subfolders including 016297c788c93c3297970932e19a5611
  2. Deleted the node_modules folder in the theme-review-action project folder and run npm install again
carolinan commented 3 years ago

As suggested, I tried the same steps with Powershell as administrator, with the same results. If it matters, I am not able to destroy wp-env in between attempts, as the wp-env destroy command is also not working.

StevenDufresne commented 3 years ago

@carolinan Thanks! The destroy problem is related to using grep which should be fixed in the @wordpress/env package.

I'll see if I can reproduce.

StevenDufresne commented 3 years ago

I wasn't able to reproduce and before deep diving can you try deleting C:\\Users\\Carolina\\.wp-env\\016297c788c93c3297970932e19a5611 and trying again.

carolinan commented 3 years ago

I tried that again as well as delete the theme review action folder and git cloned it again, force cleaned the npm cache, turned off firewalls, triple checked folder permissions, and it made no difference.

t-hamano commented 3 years ago

I got the same error. In a basic theme development environment, it happened when I specified a zip file in the core setting of .wp-env.json. Like this:

{
  "core": "https://wordpress.org/wordpress-5.6.1.zip",
  "themes": [ "." ]
}

And I tried to run the same command directly where the error occurred.

ren .\wordpress-5.6.1.temp\wordpress\ .\wordpress

then I got the following error:

The source path and target path cannot be the same. *This is a translation of a message from the Japanese terminal and is not accurate.

Instead, the following commands worked:

ren .\wordpress-5.6.1.temp\wordpress\ .\wp I think the reason is that the directory names before and after the renaming are the same.

I hope this helps.

StevenDufresne commented 3 years ago

Okay, thanks for the info. I'll take another look in the near future. Much appreciated.

carolinan commented 3 years ago

This is the current log of the terminal on Windows:


PS D:\tests\theme-review-action> npm install
audited 185 packages in 1.216s

20 packages are looking for funding
  run `npm fund` for details       

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
PS D:\tests\theme-review-action> npm run start

> wordpress-theme-check-action@1.4.11 start D:\tests\theme-review-action
> node bin/program.js

Please ensure docker is running.

Test Version: 1.4.11    
Testing Ports: 8484/8485

Steps:
× Copying theme files into the environment...
Error: Cannot copy '.' to a subdirectory of itself, 'D:\tests\theme-review-action\test-theme'.
√ Checking theme's basic structure (in 0s 896ms)
√ Setting up the development environment for testing... (in 45s 203ms)
× Running the theme through theme check plugin...
Error: Command failed with exit code 1: npm run check:theme-check
i Starting 'eval-file ./actions/theme-check/CheckTheme.php' on the cli container. 

Creating 085e2a24132c5fbc7a5f6cbae975fd3b_cli_run ... 
Creating 085e2a24132c5fbc7a5f6cbae975fd3b_cli_run ... done
[28-Jun-2021 04:09:09 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /var/www/html/wp-content/plugins/theme-check/checks/class-link-check.php:55
Stack trace:
#0 /var/www/html/wp-content/plugins/theme-check/checkbase.php(103): Link_Check->check(Array, Array, Array)
#1 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71) : eval()'d code(27): run_themechecks(Array, Array, Array)
#2 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71) : eval()'d code(171): WPORG_CheckTheme->check_theme(Array)
#3 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71) : eval()'d code(181): WPORG_CheckTheme->run_check()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71): eval()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(48): EvalFile_Command::execute_eval('./actions/theme...', Array)
#6 [internal function]: EvalFile_Command->__invoke(Array, Array)
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-c in /var/www/html/wp-content/plugins/theme-check/checks/class-link-check.php on line 55
Fatal error: Uncaught Error: Call to a member function get() on null in /var/www/html/wp-content/plugins/theme-check/checks/class-link-check.php:55
Stack trace:
#0 /var/www/html/wp-content/plugins/theme-check/checkbase.php(103): Link_Check->check(Array, Array, Array)
#1 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71) : eval()'d code(27): run_themechecks(Array, Array, Array)
#2 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71) : eval()'d code(171): WPORG_CheckTheme->check_theme(Array)
#3 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71) : eval()'d code(181): WPORG_CheckTheme->run_check()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(71): eval()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/EvalFile_Command.php(48): EvalFile_Command::execute_eval('./actions/theme...', Array)
#6 [internal function]: EvalFile_Command->__invoke(Array, Array)
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-c in /var/www/html/wp-content/plugins/theme-check/checks/class-link-check.php on line 55
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
255
× Command failed with exit code 255
Command failed with exit code 255
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wordpress-theme-check-action@1.4.11 wp-env: `wp-env "run" "cli" "eval-file" "./actions/theme-check/CheckTheme.php"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wordpress-theme-check-action@1.4.11 wp-env script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Carolina\AppData\Roaming\npm-cache\_logs\2021-06-28T04_09_09_666Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wordpress-theme-check-action@1.4.11 check:theme-check: `npm run wp-env run cli eval-file ./actions/theme-check/CheckTheme.php`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wordpress-theme-check-action@1.4.11 check:theme-check script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Carolina\AppData\Roaming\npm-cache\_logs\2021-06-28T04_09_09_685Z-debug.log

> wordpress-theme-check-action@1.4.11 check:theme-check D:\tests\theme-review-action
> npm run wp-env run cli eval-file ./actions/theme-check/CheckTheme.php

> wordpress-theme-check-action@1.4.11 wp-env D:\tests\theme-review-action
> wp-env "run" "cli" "eval-file" "./actions/theme-check/CheckTheme.php"

× Running some end to end tests on the front end...
Error: Command failed with exit code 1: npm run check:ui

npm WARN eslint-plugin-prettier@3.1.4 requires a peer of prettier@>=1.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-puppeteer@4.4.0 requires a peer of puppeteer@>= 1.5.0 < 3 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-url-polyfill@1.2.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev 
|| >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN UI-Check@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

PASS tests/e2e/specs/page/index.test.js (16.312s)
  Test URL /?feed=rss2
    √ Page should contain body class  (10ms)
    √ Page should not have PHP errors (11ms)
    √ Page should have complete output (2ms)
    √ Page should return 200 status
    √ Browser console should not contain errors (1ms)
    √ Page should not have unexpected links (4ms)
    √ Page should contain body class  (3ms)
    √ Page should not have PHP errors (9ms)
    √ Page should have complete output (1ms)
    √ Page should return 200 status
    √ Browser console should not contain errors
    √ Page should not have unexpected links (4ms)
  Test URL /?p=1241
    √ Page should contain body class single-post (4ms)
    √ Page should not have PHP errors (2ms)
    √ Page should have complete output (1ms)
    √ Page should return 200 status
    √ Browser console should not contain errors (1ms)
    √ Page should not have unexpected links (20ms)
  Test URL /
    √ Page should contain body class home (4ms)
    √ Page should not have PHP errors (13ms)
    √ Page should have complete output (2ms)
    √ Page should return 200 status (1ms)
    √ Browser console should not contain errors
    √ Page should not have unexpected links (17ms)
  Test URL /?cat=1
    √ Page should contain body class category (4ms)
    √ Page should not have PHP errors (4ms)
    √ Page should have complete output
    √ Page should return 200 status
    √ Browser console should not contain errors (1ms)
    √ Page should not have unexpected links (18ms)
  Test URL /?tag=alignment-2
    √ Page should contain body class tag (3ms)
    √ Page should not have PHP errors (3ms)
    √ Page should have complete output (1ms)
    √ Page should return 200 status
    √ Browser console should not contain errors (1ms)
    √ Page should not have unexpected links (21ms)
  Test URL /?post_format=gallery
    √ Page should contain body class tax-post_format (3ms)
    √ Page should not have PHP errors (3ms)
    √ Page should have complete output
    √ Page should return 200 status (1ms)
    √ Browser console should not contain errors
    √ Page should not have unexpected links (14ms)

FAIL tests/e2e/specs/a11y/index.test.js (31.795s)
  Accessibility
    × Should pass best-practice Axe tests on Home (30013ms)
    √ Should pass best-practice Axe tests on Post (826ms)
    √ Should pass best-practice Axe tests on Page (469ms)

  ● Accessibility › Should pass best-practice Axe tests on Home

    TimeoutError: Navigation timeout of 30000 ms exceeded

      at ../../node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111

PASS tests/e2e/specs/ui/index.test.js (20.407s)
  Accessibility: UI
    √ Should have skip links (25ms)
    √ Should have appropriate submenus (5558ms)
    √ Should have element focus state (11052ms)
    √ Should have logical tabbing (565ms)

Test Suites: 1 failed, 2 passed, 3 total
Tests:       1 failed, 48 passed, 49 total
Snapshots:   0 total
Time:        68.713s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! UI-Check@1.0.0 test:e2e: `wp-scripts test-e2e --config tests/e2e/jest.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the UI-Check@1.0.0 test:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Carolina\AppData\Roaming\npm-cache\_logs\2021-06-28T04_10_54_612Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! UI-Check@1.0.0 start: `npm run install:environment && npm run test:unit && npm run test:e2e`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the UI-Check@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Carolina\AppData\Roaming\npm-cache\_logs\2021-06-28T04_10_54_645Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wordpress-theme-check-action@1.4.11 check:ui: `cd ./actions/ui-check && npm run start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wordpress-theme-check-action@1.4.11 check:ui script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Carolina\AppData\Roaming\npm-cache\_logs\2021-06-28T04_10_54_660Z-debug.log

> wordpress-theme-check-action@1.4.11 check:ui D:\tests\theme-review-action
> cd ./actions/ui-check && npm run start

> UI-Check@1.0.0 start D:\tests\theme-review-action\actions\ui-check
> npm run install:environment && npm run test:unit && npm run test:e2e

> UI-Check@1.0.0 install:environment D:\tests\theme-review-action\actions\ui-check
> npm install

> puppeteer@5.4.1 install D:\tests\theme-review-action\actions\ui-check\node_modules\puppeteer
> node install.js

Chromium (809590) downloaded to D:\tests\theme-review-action\actions\ui-check\node_modules\puppeteer\.local-chromium\win64-809590
added 9 packages from 4 contributors, removed 1 package and audited 1910 packages in 19.571s

155 packages are looking for funding
  run `npm fund` for details

found 5729 vulnerabilities (6 low, 151 moderate, 5572 high)
  run `npm audit fix` to fix them, or `npm audit` for details

> UI-Check@1.0.0 test:unit D:\tests\theme-review-action\actions\ui-check
> wp-scripts test-unit-js --config tests/unit/jest.config.js --passWithNoTests

No tests found, exiting with code 0

> UI-Check@1.0.0 test:e2e D:\tests\theme-review-action\actions\ui-check
> wp-scripts test-e2e --config tests/e2e/jest.config.js

Chromium (737027) downloaded to D:\tests\theme-review-action\actions\ui-check\node_modules\@wordpress\scripts\node_modules\puppeteer\.local-chromium\win64-737027
× Tearing down the environment...
Error: Command failed with exit code 1: npm run wp-env destroy
i WARNING! This will remove Docker containers, volumes, and networks associated with the WordPress instance.
× Command failed: docker volume rm $(docker volume ls | grep "085e2a24132c5fbc7a5f6cbae975fd3b" | awk '/ / { print $2 }') && docker network rm $(docker network ls | grep "085e2a24132c5fbc7a5f6cbae975fd3b" | awk '/ / { print $1 }')
'grep' is not recognized as an internal or external command,
operable program or batch file.

Error: Command failed: docker volume rm $(docker volume ls | grep "085e2a24132c5fbc7a5f6cbae975fd3b" | awk '/ / { print $2 }') && docker network rm $(docker network ls | grep 
"085e2a24132c5fbc7a5f6cbae975fd3b" | awk '/ / { print $1 }')
'grep' is not recognized as an internal or external command,
operable program or batch file.

    at ChildProcess.exithandler (child_process.js:319:12)
    at ChildProcess.emit (events.js:376:20)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
  killed: false,
  code: 255,
  signal: null,
  cmd: `docker volume rm $(docker volume ls | grep "085e2a24132c5fbc7a5f6cbae975fd3b" | awk '/ / { print $2 }') && docker network rm $(docker network ls | grep "085e2a24132c5fbc7a5f6cbae975fd3b" | awk '/ / { print $1 }')`,
  stdout: '',
  stderr: "'grep' is not recognized as an internal or external command,\r\n" +
    'operable program or batch file.\r\n'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wordpress-theme-check-action@1.4.11 wp-env: `wp-env "destroy"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wordpress-theme-check-action@1.4.11 wp-env script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Carolina\AppData\Roaming\npm-cache\_logs\2021-06-28T04_11_01_767Z-debug.log

> wordpress-theme-check-action@1.4.11 wp-env D:\tests\theme-review-action
> wp-env "destroy"

? Are you sure you want to continue? Yes

User Interface Errors:

"themesbycarolina.com" found when viewing "/?p=1241" (via: single.php) is not an approved link.
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-errors.md#page-should-not-have-unexpected-links

"themesbycarolina.com" found when viewing "/" (via: index.php) is not an approved link.
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-errors.md#page-should-not-have-unexpected-links

"themesbycarolina.com" found when viewing "/?cat=1" (via: archive.php) is not an approved link.
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-errors.md#page-should-not-have-unexpected-links

"themesbycarolina.com" found when viewing "/?tag=alignment-2" (via: archive.php) is not an approved link.
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-errors.md#page-should-not-have-unexpected-links

"themesbycarolina.com" found when viewing "/?post_format=gallery" (via: archive.php) is not an approved link.
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-errors.md#page-should-not-have-unexpected-links

User Interface Warnings:

Running tests on Post /?p=1730 using: 
https://github.com/wpaccessibility/a11y-theme-unit-test

Violations found:
Rule: "landmark-complementary-is-top-level" (Aside must not be contained in another landmark)
Help: https://dequeuniversity.com/rules/axe/3.5/landmark-complementary-is-top-level?application=axe-puppeteer
Affected Nodes:
  #search-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #recent-posts-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #recent-comments-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  div[itemtype="https\:\/\/schema\.org\/WPSideBar"]
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #archives-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #categories-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #meta-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.

Rule: "landmark-unique" (Ensures landmarks are unique)
Help: https://dequeuniversity.com/rules/axe/3.5/landmark-unique?application=axe-puppeteer
Affected Nodes:
  #secondary
    Fix ANY of the following:
    - The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable

Rule: "region" (All page content must be contained by landmarks)
Help: https://dequeuniversity.com/rules/axe/3.5/region?application=axe-puppeteer
Affected Nodes:
  #page
    Fix ANY of the following:
    - Some page content is not contained by landmarks

Running tests on Page /?page_id=701 using: 
https://github.com/wpaccessibility/a11y-theme-unit-test

Violations found:
Rule: "heading-order" (Heading levels should only increase by one)
Help: https://dequeuniversity.com/rules/axe/3.5/heading-order?application=axe-puppeteer
Affected Nodes:
  #reply-title
    Fix ANY of the following:
    - Heading order invalid

Rule: "landmark-complementary-is-top-level" (Aside must not be contained in another landmark)
Help: https://dequeuniversity.com/rules/axe/3.5/landmark-complementary-is-top-level?application=axe-puppeteer
Affected Nodes:
  #search-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #recent-posts-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #recent-comments-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  div[itemtype="https\:\/\/schema\.org\/WPSideBar"]
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #archives-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #categories-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.
  #meta-2
    Fix ANY of the following:
    - The complementary landmark is contained in another landmark.

Rule: "landmark-unique" (Ensures landmarks are unique)
Help: https://dequeuniversity.com/rules/axe/3.5/landmark-unique?application=axe-puppeteer
Affected Nodes:
  #secondary
    Fix ANY of the following:
    - The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable

Rule: "region" (All page content must be contained by landmarks)
Help: https://dequeuniversity.com/rules/axe/3.5/region?application=axe-puppeteer
Affected Nodes:
  #page
    Fix ANY of the following:
    - Some page content is not contained by landmarks

Tabbing is not working as expected
Expected: <a class="skip-link screen-reader-text" href="#content">Skip to content</a>
Current: <a href="http://localhost:8485/?page_id=733">Page A</a>
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-warnings.md#should-have-logical-tabbing

Successfully ran test suite on "Aaron".
Elapsed Time: 2:43s