1

我是 prestashop 主题开发的新手。

我已经设置了我的本地环境并且一切正常。

我尝试从经典的默认主题构建主题。

我进入主题内的_dev并运行“npm install”。

接下来我运行“npm run build”来运行脚本:“build”:“NODE_ENV=production webpack --progress --colors --debug --display-chunks”

我收到以下错误:

>     ADMIN@DESKTOP-5JOQKQA MINGW64 /c/laragon/www/PrestaShopDev/themes/prodet/_dev ((1.7.7.0))
>     $ npm run build
>     
>     > prestashop-classic-dev-tools@1.0.0 build C:\laragon\www\PrestaShopDev\themes\prodet\_dev
>     > NODE_ENV=production webpack --progress --colors --debug --display-chunks
>     
>     [webpack-cli] Unknown argument: --colors
>     Did you mean --color?
>     [webpack-cli] Unknown argument: --debug
>     [webpack-cli] Unknown argument: --display-chunks
>     Note: This command was run via npm module 'win-node-env'
>     npm ERR! code ELIFECYCLE
>     npm ERR! errno 2
>     npm ERR! prestashop-classic-dev-tools@1.0.0 build: `NODE_ENV=production webpack --progress --colors --debug
> --display-chunks`
>     npm ERR! Exit status 2
>     npm ERR!
>     npm ERR! Failed at the prestashop-classic-dev-tools@1.0.0 build 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\ADMIN\AppData\Roaming\npm-cache\_logs\2020-12-11T16_17_37_009Z-debug.log

我该如何解决?

这是 package.json 文件:

{
  "name": "prestashop-classic-dev-tools",
  "version": "1.0.0",
  "description": "Tools to help while developing the Classic theme",
  "main": "index.js",
  "scripts": {
    "build": "NODE_ENV=production webpack --progress --colors --debug --display-chunks",
    "watch": "webpack --progress --colors --debug --display-chunks --watch"
  },
  "author": "PrestaShop",
  "license": "AFL-3.0",
  "devDependencies": {
    "autoprefixer": "^6.7.7",
    "babel-loader": "^8.2.2",
    "bootstrap": "4.0.0-alpha.5",
    "bootstrap-touchspin": "^3.1.1",
    "bourbon": "^4.2.6",
    "css-loader": "^5.0.1",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.10.1",
    "flexibility": "^1.0.5",
    "jquery": "^3.5.1",
    "jquery-touchswipe": "^1.6",
    "jquery.browser": "^0.1.0",
    "material-design-icons": "^2.1.3",
    "node-sass": "^4.14.1",
    "notosans-fontface": "~1.0.1",
    "postcss-flexibility": "^1.0.2",
    "postcss-loader": "^1.3.3",
    "sass-loader": "^6.0.3",
    "style-loader": "^0.14.1",
    "tether": "^1.1.1",
    "velocity-animate": "^1.2.3",
    "webpack": "^5.10.0",
    "webpack-cli": "^4.2.0",
    "webpack-sources": "^0.1.0"
  }
}

我的节点版本是:

$ node -v
v10.18.1

我的 npm 版本是:

$ npm -v
6.13.4

我真的不明白如何解决这个问题。

4

1 回答 1

0

我也是 prestashop 开发的新手。我有同样的错误。

我使用经典文件夹的第二个克隆解决了它。该错误可能是由于 webpack 版本。这是 package.json

{
  "name": "prestashop-classic-dev-tools",
  "version": "1.0.0",
  "description": "Tools to help while developing the Classic theme",
  "main": "index.js",
  "scripts": {
    "build": "NODE_ENV=production webpack --progress --colors --debug --display-chunks",
    "watch": "webpack --progress --colors --debug --display-chunks --watch"
  },
  "author": "PrestaShop",
  "license": "AFL-3.0",
  "devDependencies": {
    "autoprefixer": "^6.7.7",
    "babel-loader": "^5.3.2",
    "bootstrap": "4.0.0-alpha.5",
    "bootstrap-touchspin": "^3.1.1",
    "bourbon": "^4.2.6",
    "css-loader": "^0.27.3",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.10.1",
    "flexibility": "^1.0.5",
    "jquery": "^2.1.4",
    "material-design-icons": "^2.1.3",
    "node-sass": "^4.14.1",
    "notosans-fontface": "~1.0.1",
    "postcss-flexibility": "^1.0.2",
    "postcss-loader": "^1.3.3",
    "sass-loader": "^6.0.3",
    "style-loader": "^0.14.0",
    "tether": "^1.1.1",
    "velocity-animate": "^1.2.3",
    "webpack": "^2.2.1",
    "webpack-sources": "^0.1.0"
  }
}

在克隆之后

npm install
npm run build

对我来说,它有效并编译了主题

于 2020-12-12T19:55:23.447 回答