Akeneo installation / NODE_PATH=node_modules not recognized / yarn run webpack Error

南楼画角 提交于 2019-12-10 10:38:47

问题


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"
},


来源:https://stackoverflow.com/questions/47449037/akeneo-installation-node-path-node-modules-not-recognized-yarn-run-webpack-e

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!