Akeneo installation / NODE_PATH=node_modules not r

2019-05-11 20:44发布

问题:

I have already asked this question on git (https://github.com/akeneo/pim-community-dev/issues/7191) but unfortunately nobody has answered me yet, thought I would try SO.

I follow-up the akeneo-install-instruction (pim-community-standard-v2.0) https://docs.akeneo.com/latest/install_pim/manual/installation_ce_archive.html#initializing-akeneo

yarn run webpack

https://github.com/akeneo/pim-community-dev/blob/2.0/webpack.config.js

Gives me an error:

$ yarn run sync && NODE_PATH=node_modules webpack --config $npm_package_config_source/webpack.config.js --env=prod warning package.json: No license field $ NODE_PATH=node_modules node $npm_package_config_check --source=$npm_package_config_source 'NODE_PATH' is not recognized as an internal or external command, operable program or batch file.

What am I doing wrong?

回答1:

First of all, if you're using windows you should remove this part NODE_PATH=node_modules. You should add this variable to your environment variables. There is already a question about it: Nodejs cannot find installed module on Windows?.

Second, if you trigger yarn, it goes to package.json and search for variable "scripts". Webpack doesn't know what is $npm_package_config_source and $npm_package_config_check. It looks like not initialized PHP variables, but I might be wrong. There are 2 variables in the package.json :

"config": {
    "source": "vendor/akeneo/pim-community-dev",
    "check": "vendor/akeneo/pim-community-dev/webpack/check-dependencies.js"
},

If so, you should change scripts variable in package.json to this:

"scripts": {
    "sync": "node vendor/akeneo/pim-community-dev/webpack/check-dependencies.js --source=vendor/akeneo/pim-community-dev",
    "webpack": "yarn run sync && webpack --config vendor/akeneo/pim-community-dev/webpack.config.js --env=prod",
    "webpack-dev": "yarn run sync && webpack --config vendor/akeneo/pim-community-dev/webpack.config.js",
    "webpack-watch": "yarn run sync && webpack --progress --config vendor/akeneo/pim-community-dev/webpack.config.js --watch"
},


标签: yarn akeneo