构建 Shopify App Template – PHP 时,ln -sf ../frontend/dist/assets public/assets,’ln’ is not recognized as an internal or external command,operable program or batch file.
1、在执行:npm run build 时,报错:ln -sf ../frontend/dist/assets public/assets,’ln’ is not recognized as an internal or external command,operable program or batch file. 。如图1
PS E:\wwwroot\shopify-app\learn-php-app-20230510> npm run build --api-key=a3ca28cb106a5280859a9a52994d3446 > learn-php-app-20230510@1.0.0 build > shopify app build frontend │ frontend │ > build frontend │ > vite build frontend │ backend │ > composer build-frontend-links frontend │ frontend │ Building the frontend app without an API key. The frontend build will not run without an API key. Set the SHOPIFY_API_KEY environment variable when running the build command. frontend │ frontend │ vite v2.9.15 building for production... frontend │ transforming... backend │ > ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html backend │ 'ln' is not recognized as an internal or external command, backend │ operable program or batch file. backend │ Script ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html handling the build-frontend-links event returned with error code 1 backend │ Script composer build-frontend-links handling the build event returned with error code 1 ── external error ────────────────────────────────────────────────────────────── Error coming from `composer build` Command failed with exit code 1: composer build > composer build-frontend-links > ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html 'ln' is not recognized as an internal or external command, operable program or batch file. Script ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html handling the build-frontend-links event returned with error code 1 Script composer build-frontend-links handling the build event returned with error code 1 ──────────────────────────────────────────────────────────────────────────────── Error: Failed to kill process 17484: Error: Command failed: taskkill /pid 17484 /T /F ERROR: The process "17484" not found. at file:///E:/wwwroot/shopify-app/learn-php-app-20230510/node_modules/@shopify/cli-kit/dist/public/node/system.js:49:27 at ChildProcess.exithandler (node:child_process:404:5) at ChildProcess.emit (node:events:390:28) at ChildProcess.emit (node:domain:475:12) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) PS E:\wwwroot\shopify-app\learn-php-app-20230510>
2、由于 Windows 系统不支持,最终决定在 WSL2 中的 Ubuntu-20.04 系统中执行此命令。提示:No such file or directory 。如图2
3、可参考:在 WSL2 中的 Ubuntu-20.04 中创建应用:Shopify App Template – PHP https://www.shuijingwanwq.com/2023/07/01/7792/
4、再次运行构建命令,不再报错。
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-ubuntu-2004-0605$ npm run build --api-key=4611762cfca6d9d949cb806d776c7088 > learn-php-app-ubuntu-2004-0605@1.0.0 build > shopify app build frontend │ frontend │ > shopify-frontend-template-react@1.0.0 build frontend │ > vite build frontend │ frontend │ frontend │ > shopify-frontend-template-react@1.0.0 build frontend │ > vite build frontend │ frontend │ frontend │ Building the frontend app without an API key. The frontend build will not run without an API key. Set the SHOPIFY_API_KEY environment variable when running the build command. frontend │ frontend │ frontend │ Building the frontend app without an API key. The frontend build will not run without an API key. Set the SHOPIFY_API_KEY environment variable when running the build command. frontend │ frontend │ vite v4.3.9 building for production... frontend │ vite v4.3.9 building for production... frontend │ transforming... frontend │ transforming... backend │ > composer build-frontend-links backend │ > ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html frontend │ ✓ 1877 modules transformed. frontend │ ✓ 1877 modules transformed. frontend │ rendering chunks... frontend │ rendering chunks... frontend │ computing gzip size... frontend │ computing gzip size... frontend │ dist/assets/empty-state-8039a1e1.svg 0.26 kB │ gzip: 0.20 kB frontend │ dist/assets/empty-state-8039a1e1.svg 0.26 kB │ gzip: 0.20 kB frontend │ dist/index.html 0.48 kB │ gzip: 0.33 kB frontend │ dist/assets/home-trophy-d70b3542.png 20.65 kB frontend │ dist/assets/index-37530742.css 371.48 kB │ gzip: 45.42 kB frontend │ dist/assets/ja-abb1af27.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/ko-ef9a93f5.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/th-32f01d1c.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/zh-4775ba45.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/vi-72f55a87.js 0.23 kB │ gzip: 0.17 kB frontend │ dist/assets/nb-79727cd5.js 0.24 kB │ gzip: 0.17 kB frontend │ dist/assets/tr-d5c962f0.js 0.24 kB │ gzip: 0.17 kB frontend │ dist/assets/de-5d4a5256.js 0.28 kB │ gzip: 0.20 kB frontend │ dist/assets/fi-e67a7779.js 0.28 kB │ gzip: 0.20 kB frontend │ dist/assets/nl-ed6c02b1.js 0.28 kB │ gzip: 0.20 kB frontend │ dist/assets/da-9b835bb8.js 0.31 kB │ gzip: 0.22 kB frontend │ dist/assets/cs-d855408e.js 0.32 kB │ gzip: 0.23 kB frontend │ dist/assets/sv-8ac62b51.js 0.37 kB │ gzip: 0.25 kB frontend │ dist/assets/en-d265ad8d.js 0.41 kB │ gzip: 0.26 kB frontend │ dist/assets/es-fd2f35f4.js 0.41 kB │ gzip: 0.29 kB frontend │ dist/assets/pt-227fd344.js 0.41 kB │ gzip: 0.29 kB frontend │ dist/assets/pt-PT-a0c51464.js 0.41 kB │ gzip: 0.29 kB frontend │ dist/assets/pl-ab15c7ea.js 0.42 kB │ gzip: 0.29 kB frontend │ dist/assets/fr-23e50d95.js 0.43 kB │ gzip: 0.29 kB frontend │ dist/assets/it-08f76780.js 0.45 kB │ gzip: 0.30 kB frontend │ dist/assets/en-df34a502.js 1.53 kB │ gzip: 0.77 kB frontend │ dist/assets/de-2ae5c9fa.js 1.72 kB │ gzip: 0.90 kB frontend │ dist/assets/fr-5253333d.js 1.83 kB │ gzip: 0.94 kB frontend │ dist/assets/polyfill-force-b2df9935.js 5.21 kB │ gzip: 2.02 kB frontend │ dist/assets/zh-CN-cf74d136.js 7.72 kB │ gzip: 3.26 kB frontend │ dist/assets/zh-TW-6a74a185.js 7.86 kB │ gzip: 3.36 kB frontend │ dist/assets/ko-2cf626e6.js 8.18 kB │ gzip: 3.39 kB frontend │ dist/assets/ja-6f78282b.js 8.35 kB │ gzip: 3.58 kB frontend │ dist/assets/en-c240dff3.js 9.95 kB │ gzip: 2.95 kB frontend │ dist/assets/vi-e4ef4fd6.js 9.97 kB │ gzip: 3.34 kB frontend │ dist/assets/th-2a34d5e0.js 10.14 kB │ gzip: 3.77 kB frontend │ dist/assets/sv-a901b08f.js 10.22 kB │ gzip: 3.27 kB frontend │ dist/assets/da-1564850b.js 10.30 kB │ gzip: 3.26 kB frontend │ dist/assets/nb-0a6d8490.js 10.35 kB │ gzip: 3.25 kB frontend │ dist/assets/pl-a603e9c2.js 10.39 kB │ gzip: 3.39 kB frontend │ dist/assets/cs-3c753a97.js 10.40 kB │ gzip: 3.50 kB frontend │ dist/assets/fi-c0a9d95f.js 10.63 kB │ gzip: 3.41 kB frontend │ dist/assets/tr-bd45be97.js 10.68 kB │ gzip: 3.39 kB frontend │ dist/assets/it-8bb02787.js 10.72 kB │ gzip: 3.32 kB frontend │ dist/assets/pt-PT-af188c06.js 10.85 kB │ gzip: 3.34 kB frontend │ dist/assets/nl-0772ea77.js 10.89 kB │ gzip: 3.25 kB frontend │ dist/assets/pt-BR-8a1d5660.js 10.94 kB │ gzip: 3.36 kB frontend │ dist/assets/es-5e0e20e7.js 10.95 kB │ gzip: 3.39 kB frontend │ dist/assets/de-a04fe3bd.js 11.11 kB │ gzip: 3.35 kB frontend │ dist/assets/fr-1848494a.js 11.31 kB │ gzip: 3.48 kB frontend │ dist/assets/index-92a00347.js 38.36 kB │ gzip: 15.16 kB frontend │ dist/assets/polyfill-6fab3648.js 133.64 kB │ gzip: 40.74 kB frontend │ dist/assets/index-e36d32ea.js 614.98 kB │ gzip: 163.80 kB frontend │ ✓ built in 43.09s frontend │ frontend │ (!) Some chunks are larger than 500 kBs after minification. Consider: frontend │ - Using dynamic import() to code-split the application frontend │ - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks frontend │ - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. frontend │ dist/index.html 0.48 kB │ gzip: 0.33 kB frontend │ dist/assets/home-trophy-d70b3542.png 20.65 kB frontend │ dist/assets/index-37530742.css 371.48 kB │ gzip: 45.42 kB frontend │ dist/assets/ja-abb1af27.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/ko-ef9a93f5.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/th-32f01d1c.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/zh-4775ba45.js 0.21 kB │ gzip: 0.15 kB frontend │ dist/assets/vi-72f55a87.js 0.23 kB │ gzip: 0.17 kB frontend │ dist/assets/nb-79727cd5.js 0.24 kB │ gzip: 0.17 kB frontend │ dist/assets/tr-d5c962f0.js 0.24 kB │ gzip: 0.17 kB frontend │ dist/assets/nl-ed6c02b1.js 0.28 kB │ gzip: 0.20 kB frontend │ dist/assets/fi-e67a7779.js 0.28 kB │ gzip: 0.20 kB frontend │ dist/assets/de-5d4a5256.js 0.28 kB │ gzip: 0.20 kB frontend │ dist/assets/da-9b835bb8.js 0.31 kB │ gzip: 0.22 kB frontend │ dist/assets/cs-d855408e.js 0.32 kB │ gzip: 0.23 kB frontend │ dist/assets/sv-8ac62b51.js 0.37 kB │ gzip: 0.25 kB frontend │ dist/assets/en-d265ad8d.js 0.41 kB │ gzip: 0.26 kB frontend │ dist/assets/es-fd2f35f4.js 0.41 kB │ gzip: 0.29 kB frontend │ dist/assets/pt-227fd344.js 0.41 kB │ gzip: 0.29 kB frontend │ dist/assets/pt-PT-a0c51464.js 0.41 kB │ gzip: 0.29 kB frontend │ dist/assets/pl-ab15c7ea.js 0.42 kB │ gzip: 0.29 kB frontend │ dist/assets/fr-23e50d95.js 0.43 kB │ gzip: 0.29 kB frontend │ dist/assets/it-08f76780.js 0.45 kB │ gzip: 0.30 kB frontend │ dist/assets/en-df34a502.js 1.53 kB │ gzip: 0.77 kB frontend │ dist/assets/de-2ae5c9fa.js 1.72 kB │ gzip: 0.90 kB frontend │ dist/assets/fr-5253333d.js 1.83 kB │ gzip: 0.94 kB frontend │ dist/assets/polyfill-force-b2df9935.js 5.21 kB │ gzip: 2.02 kB frontend │ dist/assets/zh-CN-cf74d136.js 7.72 kB │ gzip: 3.26 kB frontend │ dist/assets/zh-TW-6a74a185.js 7.86 kB │ gzip: 3.36 kB frontend │ dist/assets/ko-2cf626e6.js 8.18 kB │ gzip: 3.39 kB frontend │ dist/assets/ja-6f78282b.js 8.35 kB │ gzip: 3.58 kB frontend │ dist/assets/en-c240dff3.js 9.95 kB │ gzip: 2.95 kB frontend │ dist/assets/vi-e4ef4fd6.js 9.97 kB │ gzip: 3.34 kB frontend │ dist/assets/th-2a34d5e0.js 10.14 kB │ gzip: 3.77 kB frontend │ dist/assets/sv-a901b08f.js 10.22 kB │ gzip: 3.27 kB frontend │ dist/assets/da-1564850b.js 10.30 kB │ gzip: 3.26 kB frontend │ dist/assets/nb-0a6d8490.js 10.35 kB │ gzip: 3.25 kB frontend │ dist/assets/pl-a603e9c2.js 10.39 kB │ gzip: 3.39 kB frontend │ dist/assets/cs-3c753a97.js 10.40 kB │ gzip: 3.50 kB frontend │ dist/assets/fi-c0a9d95f.js 10.63 kB │ gzip: 3.41 kB frontend │ dist/assets/tr-bd45be97.js 10.68 kB │ gzip: 3.39 kB frontend │ dist/assets/it-8bb02787.js 10.72 kB │ gzip: 3.32 kB frontend │ dist/assets/pt-PT-af188c06.js 10.85 kB │ gzip: 3.34 kB frontend │ dist/assets/nl-0772ea77.js 10.89 kB │ gzip: 3.25 kB frontend │ dist/assets/pt-BR-8a1d5660.js 10.94 kB │ gzip: 3.36 kB frontend │ dist/assets/es-5e0e20e7.js 10.95 kB │ gzip: 3.39 kB frontend │ dist/assets/de-a04fe3bd.js 11.11 kB │ gzip: 3.35 kB frontend │ dist/assets/fr-1848494a.js 11.31 kB │ gzip: 3.48 kB frontend │ dist/assets/index-92a00347.js 38.36 kB │ gzip: 15.16 kB frontend │ dist/assets/polyfill-6fab3648.js 133.64 kB │ gzip: 40.74 kB frontend │ dist/assets/index-e36d32ea.js 614.98 kB │ gzip: 163.80 kB frontend │ ✓ built in 43.05s frontend │ frontend │ (!) Some chunks are larger than 500 kBs after minification. Consider: frontend │ - Using dynamic import() to code-split the application frontend │ - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks frontend │ - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. ╭─ success ────────────────────────────────────────────────────────────────────╮ │ │ │ learn-php-app-ubuntu-2004-0605 built! │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-ubuntu-2004-0605$
近期评论