shopware: Watch-administration command not working properly
PHP Version: 8.2 | Shopware Version: 6.6.1 | Affected area / extension: Platform(Default)
Expected behaviour:
The command should start a process that watches for changes in the administration code files (JavaScript, CSS, etc.) and should reload the site immediately.
Actual behaviour:
When I run this command it throws these errors:
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:2:16 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 1 | import { Project, ts } from “ts-morph”; 2 | import fs from ‘fs’; | ^^^^ 3 | import path from ‘path’; 4 | 5 | const noArgumentProvided = process.argv.length === 2;
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:3:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 1 | import { Project, ts } from “ts-morph”; 2 | import fs from ‘fs’; 3 | import path from ‘path’; | ^^^^^^ 4 | 5 | const noArgumentProvided = process.argv.length === 2; 6 | if (noArgumentProvided) {
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:5:36 TS2339: Property ‘argv’ does not exist on type ‘Process’. 3 | import path from ‘path’; 4 | 5 | const noArgumentProvided = process.argv.length === 2; | ^^^^ 6 | if (noArgumentProvided) { 7 | console.error(‘Please provide a target directory.’); 8 |
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:9:13 TS2339: Property ‘exit’ does not exist on type ‘Process’. 7 | console.error(‘Please provide a target directory.’); 8 | 9 | process.exit(1); | ^^^^ 10 | } 11 | 12 | function fromPlatformRootDirectory(…paths: string[]) {
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:13:25 TS2304: Cannot find name ‘__dirname’. 11 | 12 | function fromPlatformRootDirectory(…paths: string[]) { 13 | return path.resolve(__dirname, ‘…/…/…/…/…/…/…/…/’, …paths); | ^^^^^^^^^ 14 | } 15 | 16 | const targetDirectory = process.argv[2];
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:16:33 TS2339: Property ‘argv’ does not exist on type ‘Process’. 14 | } 15 | 16 | const targetDirectory = process.argv[2]; | ^^^^ 17 | if (!fs.existsSync(fromPlatformRootDirectory(targetDirectory))) { 18 | console.error(‘Target directory does not exist.’); 19 |
ERROR in ./scripts/codemods/js-vue3-feature-flag-removal/index.ts:20:13 TS2339: Property ‘exit’ does not exist on type ‘Process’. 18 | console.error(‘Target directory does not exist.’); 19 | 20 | process.exit(1); | ^^^^ 21 | } 22 | 23 | const project = new Project({
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:1:16 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 1 | import fs from ‘fs’; | ^^^^ 2 | import path from ‘path’; 3 | import readline from ‘readline’; 4 |
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:2:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 1 | import fs from ‘fs’; 2 | import path from ‘path’; | ^^^^^^ 3 | import readline from ‘readline’; 4 | 5 | const terminalInterface = readline.createInterface({
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:3:22 TS2307: Cannot find module ‘readline’ or its corresponding type declarations. 1 | import fs from ‘fs’; 2 | import path from ‘path’; 3 | import readline from ‘readline’; | ^^^^^^^^^^ 4 | 5 | const terminalInterface = readline.createInterface({ 6 | input: process.stdin,
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:6:20 TS2339: Property ‘stdin’ does not exist on type ‘Process’. 4 | 5 | const terminalInterface = readline.createInterface({ 6 | input: process.stdin, | ^^^^^ 7 | output: process.stdout 8 | }); 9 |
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:7:21 TS2339: Property ‘stdout’ does not exist on type ‘Process’. 5 | const terminalInterface = readline.createInterface({ 6 | input: process.stdin, 7 | output: process.stdout | ^^^^^^ 8 | }); 9 | 10 | function modifyCode(inputCode: string): string {
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:79:96 TS7006: Parameter ‘givenSrcPath’ implicitly has an ‘any’ type. 77 | } 78 | 79 | terminalInterface.question(‘What is the source directory of the files you want to change? \n’, givenSrcPath => { | ^^^^^^^^^^^^ 80 | const srcPath = path.resolve(givenSrcPath); 81 | 82 | // Read all files recursively ending with .html.twig
ERROR in ./scripts/codemods/twig-feature-flag-removal/index.ts:84:47 TS7006: Parameter ‘file’ implicitly has an ‘any’ type. 82 | // Read all files recursively ending with .html.twig 83 | function throughDirectory(directoryPath: string, files: string[] = []) { 84 | fs.readdirSync(directoryPath).forEach(file => { | ^^^^ 85 | const absolutePath = path.join(directoryPath, file); 86 | 87 | if (fs.statSync(absolutePath).isDirectory()) {
ERROR in ./scripts/componentImportResolver/generate.ts:6:23 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 4 | */ 5 | import { ArrowFunction, CallExpression, Project, SourceFile, ts} from “ts-morph”; 6 | import * as path from “path”; | ^^^^^^ 7 | import * as fs from “fs”; 8 | 9 | const project = new Project({
ERROR in ./scripts/componentImportResolver/generate.ts:7:21 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 5 | import { ArrowFunction, CallExpression, Project, SourceFile, ts} from “ts-morph”; 6 | import * as path from “path”; 7 | import * as fs from “fs”; | ^^^^ 8 | 9 | const project = new Project({ 10 | skipAddingFilesFromTsConfig: true,
ERROR in ./scripts/componentImportResolver/generate.ts:225:28 TS2304: Cannot find name ‘__dirname’. 223 | // Write output to file 224 | const filestring =
/* eslint-disable */\n\nexport default ${JSON.stringify(componentImportMap)};225 | fs.writeFileSync(path.join(__dirname, ‘/…/…/test/helper/componentWrapper/component-imports.js’), filestring); | ^^^^^^^^^ 226 |
ERROR in ./scripts/entitySchemaConverter/convert-schema.ts:2:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 1 | import entitySchema from “…/…/test/mocks/entity-schema.json”; 2 | import path from ‘path’; | ^^^^^^ 3 | import { EntitySchemaConverter } from “./entity-schema-converter”; 4 | 5 | const converter = new EntitySchemaConverter();
ERROR in ./scripts/entitySchemaConverter/entity-schema-converter.ts:1:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 1 | import path from ‘path’; | ^^^^^^ 2 | import {InterfaceDeclarationStructure, OptionalKind, Project} from ‘ts-morph’; 3 | import type { EntitySchemaTypes } from ‘./EntitySchemaTypes’; 4 |
ERROR in ./scripts/entitySchemaConverter/generate-package.ts:1:16 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 1 | import fs from ‘fs’; | ^^^^ 2 | import path from ‘path’; 3 | import entitySchema from “…/…/test/mocks/entity-schema.json”; 4 | import { EntitySchemaConverter } from “./entity-schema-converter”;
ERROR in ./scripts/entitySchemaConverter/generate-package.ts:2:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 1 | import fs from ‘fs’; 2 | import path from ‘path’; | ^^^^^^ 3 | import entitySchema from “…/…/test/mocks/entity-schema.json”; 4 | import { EntitySchemaConverter } from “./entity-schema-converter”; 5 |
ERROR in ./scripts/entitySchemaConverter/generate-package.ts:15:41 TS2304: Cannot find name ‘__dirname’. 13 | const converter = new EntitySchemaConverter(); 14 | const packageName = ‘@shopware-ag/entity-schema-types’ 15 | const folderPackagePath = path.join(__dirname, ‘…/…/entity-schema-types’); | ^^^^^^^^^ 16 | const definitionFileName = ‘entity-schema-definition.d.ts’; 17 | const packageVersion = gitCommitTag.replace(‘v6.’, ‘’); 18 |
ERROR in ./scripts/generate-data-set-list/index.ts:6:16 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 4 | */ 5 | 6 | import fs from ‘fs’; | ^^^^ 7 | import path from ‘path’; 8 | // @ts-expect-error - There are no types for this package 9 | import cliProgress from ‘cli-progress’;
ERROR in ./scripts/generate-data-set-list/index.ts:7:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 5 | 6 | import fs from ‘fs’; 7 | import path from ‘path’; | ^^^^^^ 8 | // @ts-expect-error - There are no types for this package 9 | import cliProgress from ‘cli-progress’; 10 | import chalk from ‘chalk’;
ERROR in ./scripts/generate-data-set-list/index.ts:21:20 TS7006: Parameter ‘file’ implicitly has an ‘any’ type. 19 | arrayOfFiles = arrayOfFiles || []; 20 | 21 | files.forEach((file) => { | ^^^^ 22 | if (fs.statSync(
${dirPath}/${file}).isDirectory()) { 23 | // If the file is a directory, recursively get its files 24 | arrayOfFiles = getAllFiles(${dirPath}/${file}, arrayOfFiles);
ERROR in ./scripts/generate-data-set-list/index.ts:34:40 TS2304: Cannot find name ‘__dirname’. 32 | 33 | // Get all HTML Twig template files from the specified directory 34 | const srcFiles = getAllFiles(path.join(__dirname, ‘…/…/src’)).filter(file => { | ^^^^^^^^^ 35 | return file.match(/^.*(?<!.spec|vue2)(?<!/acl/index)(?<!.d).(js|ts)$/); 36 | }); 37 |
ERROR in ./scripts/generate-data-set-list/index.ts:65:30 TS2304: Cannot find name ‘__dirname’. 63 | 64 | // Define the output file path for the result 65 | const outputFile = path.join(__dirname, ‘…/…/src/meta/data-sets.json’); | ^^^^^^^^^ 66 | 67 | console.log(chalk.blueBright(
\nWriting to ${outputFile})); 68 | fs.writeFileSync(outputFile, JSON.stringify(result));
ERROR in ./scripts/generate-position-identifier-list/index.ts:6:16 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 4 | */ 5 | 6 | import fs from ‘fs’; | ^^^^ 7 | import path from ‘path’; 8 | // @ts-expect-error - There are no types for this package 9 | import cliProgress from ‘cli-progress’;
ERROR in ./scripts/generate-position-identifier-list/index.ts:7:18 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 5 | 6 | import fs from ‘fs’; 7 | import path from ‘path’; | ^^^^^^ 8 | // @ts-expect-error - There are no types for this package 9 | import cliProgress from ‘cli-progress’; 10 | import chalk from ‘chalk’;
ERROR in ./scripts/generate-position-identifier-list/index.ts:21:20 TS7006: Parameter ‘file’ implicitly has an ‘any’ type. 19 | arrayOfFiles = arrayOfFiles || []; 20 | 21 | files.forEach((file) => { | ^^^^ 22 | if (fs.statSync(
${dirPath}/${file}).isDirectory()) { 23 | // If the file is a directory, recursively get its files 24 | arrayOfFiles = getAllFiles(${dirPath}/${file}, arrayOfFiles);
ERROR in ./scripts/generate-position-identifier-list/index.ts:34:45 TS2304: Cannot find name ‘__dirname’. 32 | 33 | // Get all HTML Twig template files from the specified directory 34 | const templateFiles = getAllFiles(path.join(__dirname, ‘…/…/src’)).filter(file => { | ^^^^^^^^^ 35 | return file.match(/^.*.html.twig$/); 36 | }); 37 |
ERROR in ./scripts/generate-position-identifier-list/index.ts:64:30 TS2304: Cannot find name ‘__dirname’. 62 | 63 | // Define the output file path for the result 64 | const outputFile = path.join(__dirname, ‘…/…/src/meta/position-identifiers.json’); | ^^^^^^^^^ 65 | 66 | console.log(chalk.blueBright(
\nWriting to ${outputFile})); 67 | fs.writeFileSync(outputFile, JSON.stringify(result));
ERROR in ./scripts/vueCompatComponentsStatistics/generate.ts:2:23 TS2307: Cannot find module ‘path’ or its corresponding type declarations. 1 | import { ArrowFunction, CallExpression, Project, SourceFile, ts} from “ts-morph”; 2 | import * as path from “path”; | ^^^^^^ 3 | import * as fs from “fs”; 4 | 5 | const project = new Project({
ERROR in ./scripts/vueCompatComponentsStatistics/generate.ts:3:21 TS2307: Cannot find module ‘fs’ or its corresponding type declarations. 1 | import { ArrowFunction, CallExpression, Project, SourceFile, ts} from “ts-morph”; 2 | import * as path from “path”; 3 | import * as fs from “fs”; | ^^^^ 4 | 5 | const project = new Project({ 6 | skipAddingFilesFromTsConfig: true,
ERROR in ./scripts/vueCompatComponentsStatistics/generate.ts:218:28 TS2304: Cannot find name ‘__dirname’. 216 | 217 | const filestring = JSON.stringify(readableFileStructure, null, “\t”); 218 | fs.writeFileSync(path.join(__dirname, ‘/…/…/.vue-compat-components-statistics.json’), filestring); | ^^^^^^^^^ 219 |
ERROR in ./src/app/component/extension-api/sw-extension-component-section/index.ts:64:21 TS2578: Unused ‘@ts-expect-error’ directive. 62 |
The extension "${section.extensionName}" uses a deprecated position identifier "${this.positionIdentifier}". ${this.deprecationMessage}, 63 | ]; 64 | // @ts-expect-error | ^^^^^^^^^^^^^^^^^^^ 65 | if (process.env !== ‘prod’) { 66 | Shopware.Utils.debug.error(…debugArgs); 67 | } else {
ERROR in ./src/app/service/file-validation.service.ts:109:63 TS2550: Property ‘at’ does not exist on type ‘string[]’. Do you need to change your target library? Try changing the ‘lib’ compiler option to ‘es2022’ or later. 107 | 108 | return fileExtensions.some((extension) => { 109 | const currentFileExtension = file.name.split(‘.’).at(-1); | ^^ 110 | 111 | if (!currentFileExtension) { 112 | return false;
ERROR in ./src/app/service/file-validation.service.ts:144:38 TS2550: Property ‘at’ does not exist on type ‘string[]’. Do you need to change your target library? Try changing the ‘lib’ compiler option to ‘es2022’ or later. 142 | if ( 143 | mimeAccept === ‘model/gltf-binary’ && 144 | file.name.split(‘.’).at(-1) === ‘glb’ && | ^^ 145 | file.type === ‘’ 146 | ) { 147 | return true;
ERROR in ./src/core/service/extension-api-data.service.ts:144:9 TS2578: Unused ‘@ts-expect-error’ directive. 142 |
The extension "${extension.name}" uses a deprecated data set "${data.id}". ${registeredDataSet.deprecationMessage}, 143 | ]; 144 | // @ts-expect-error | ^^^^^^^^^^^^^^^^^^^ 145 | if (process.env !== ‘prod’) { 146 | Shopware.Utils.debug.error(…debugArgs); 147 | } else {//`
Also doesn’t open anything on the default port.
How to reproduce:
Running the command through ddev ‘ddev exec bin/watch-administration.sh’
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (9 by maintainers)
@seggewiss 🙏 for the quick response! It has been very useful, for those not wanting to wait until the fix is rolled out, I notice starting the watcher like this
DISABLE_ADMIN_COMPILATION_TYPECHECK=1 bin/watch-administration.shshould resolve the errors.
@seggewiss Would like to have this re-opened please, if possible.
Having same issue up to 6.6.7.0, not related to ddev, can be reproduced in other environments, both using Symfony Flex and the web installer. Definitely not solved by https://github.com/shopware/shopware/pull/3762 in production environments.
@vanWittlaer Thats exactly what we added to the scripts 👍