如何解决如何建立开发环境来构建prestashop主题资产?
根据Prestashop's documentation,我正在尝试构建Prestashop classic
主题的资产。我在Windows 10上使用cygwin。这是我详细执行的操作:
- 我派出了最新的稳定标签(
1.7.6.7
)。 - 我在
./tools/assets/build.sh
中运行了cygwin
。 (我也在Windows Terminal和step by step中尝试过,即cd主题目录,后跟npm install
。)
npm install
抛出错误,抱怨缺少Python
。
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python",you can set the PYTHON env variable.
-
我安装了Python 3,并收到错误消息,抱怨缺少
Python 2.7
-
我安装了python 2.7,并因抱怨缺少
Visual Studio 2008
而报错。Projet "E:\xampp\htdocs\prestashop\themes\classic\_dev\node_modules\node-sass\build\binding.sln" sur le noud 1 (cibles par défaut). ValidateSolutionConfiguration: Génération de la configuration de solution "Release|x64". MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed,either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5,or 2) install Microsoft Visual Studio 2008. [E:\xampp\htdocs\prestashop\themes\classic\_dev\node_modules\node-sass\build\binding.sln] Génération du projet "E:\xampp\htdocs\prestashop\themes\classic\_dev\node_modules\node-sass\build\binding.sln" terminée (cibles par défaut) -- ÉCHEC.
在继续尝试和尝试之前,我想问一问是否有人知道为Prestashop主题设置完整的开发环境需要哪些先决条件。或者更确切地说,在能够运行npm install
之前我必须安装的软件列表是什么?
https://devdocs.prestashop.com/显然没有提供任何线索,它们仅说明npm
和composer
here的安装。
有人在设置Prestashop开发环境方面有经验吗?感谢您的帮助。
解决方法
经典主题使用webpack来编译资产,更多信息: https://devdocs.prestashop.com/1.7/development/compile-assets/
最好的方法是导航到themes/classic/_dev
并运行npm install
:)之后,您可以使用npm run watch
或npm run build
或任何其他定义的脚本
答案不是直接的:
主题使用node-sass
,该主题使用node-gyp
编译。
正如readme of node-gyp所述,在Windows上,我们需要安装npm install --global --production windows-build-tools
,它可以处理Python和Visual Studio。
Prestashop 1.7.6.7最新稳定发行版的主题使用带有节点12.x的node-sass
版本(^4.11.0
)which is not compatible。
因此,我们需要安装nvm for windows并使用最新版本的节点10.x分支。
通过这些步骤,npm install
将起作用。
npm run build
将失败,因为npm脚本与Windows不兼容。
代替npm run build
(调用NODE_ENV=production webpack --progress --colors --debug --display-chunks
),我们必须运行
set NODE_ENV=production
npx webpack --progress --colors --debug --display-chunks
Prestashop开发人员似乎从未尝试过在Windows上运行他们的工作。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。