Hi,
I got this project created by external company and they used nodejs+reactjs implementing it. I got from them instructions how to build the project afterwards if needed but the building process does not go through without errors. What I have done so far:
- Installed nodejs and npm
- tried to run “
npm run build:test
” and “npm build:production
” command - Getting the following error during
npm run build:test
andnpm run build:production
commands:
ERROR in ./src/components/ResultsChart.js
Module not found: Error: Cannot resolve module 'lodash/foreach' in /home/myuser/test/
@ ./src/components/ResultsChart.js 31:15-40
My package.json is following:
{
"name": "projectname",
"version": "1.0.0",
"description": "Client written with React & Redux",
"license": "MIT",
"homepage": "http://testpage.com",
"scripts": {
"clean": "rimraf dist",
"build:webpack:production": "NODE_ENV=production cross-env webpack --config webpack/webpack.config.prod.js",
"build:webpack:test": "NODE_ENV=production cross-env webpack --config webpack/webpack.config.test.js",
"build:production": "npm run clean && npm run build:webpack:production",
"build:test": "npm run clean && npm run build:webpack:test",
"dev": "NODE_ENV=development npm start",
"start": "node devServer.js",
"lint": "eslint src",
"test": "NODE_PATH=./src:. mocha --compilers js:babel-core/register ./src/test/**/*.test.js",
"deploy:production": "npm run build:production && ./tools/deploy-production.sh",
"deploy:test": "npm run build:test && ./tools/deploy-test.sh"
},
"devDependencies": {
"autoprefixer": "^6.3.3",
"babel-core": "^6.3.15",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.0",
"chai": "^3.5.0",
"cross-env": "^2.0.0",
"css-loader": "^0.23.1",
"eslint": "^3.3.1",
"eslint-config-airbnb": "^10.0.0",
"eslint-import-resolver-webpack": "^0.5.1",
"eslint-plugin-babel": "^3.0.0",
"eslint-plugin-import": "^1.8.0",
"eslint-plugin-jsx-a11y": "^2.1.0",
"eslint-plugin-react": "^6.0.0",
"eventsource-polyfill": "^0.9.6",
"exports-loader": "^0.6.3",
"express": "^4.13.3",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"form-data": "^1.0.0-rc4",
"html-webpack-plugin": "^2.10.0",
"imports-loader": "^0.6.5",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"mocha": "^2.4.5",
"node-sass": "^3.4.2",
"postcss-loader": "^0.9.1",
"redux-logger": "^2.4.0",
"rimraf": "^2.4.3",
"sass-loader": "^4.0.0",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"webpack": "^1.12.12",
"webpack-dashboard": "0.0.1-alpha.1",
"webpack-dev-middleware": "^1.4.0",
"webpack-hot-middleware": "^2.6.0"
},
"dependencies": {
"babel-polyfill": "^6.13.0",
"chart.js": "^2.2.1",
"classnames": "^2.2.5",
"font-awesome": "^4.6.3",
"history": "2.1.2",
"i18n-react": "^0.3.0",
"immutable": "^3.7.6",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.13.1",
"moment": "^2.14.1",
"react": "^15.0.2",
"react-autosuggest": "^6.0.3",
"react-big-calendar": "github:user/react-big-calendar",
"react-dom": "^15.0.2",
"react-immutable-proptypes": "^2.1.0",
"react-redux": "^4.1.1",
"react-redux-toastr": "^3.6.0",
"react-router": "^2.0.1",
"react-router-redux": "^4.0.0",
"react-sanfona": "0.0.15",
"recompose": "^0.20.2",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
"svg-inline-loader": "^0.6.1",
"validator": "^5.4.0",
"whatwg-fetch": "^1.0.0"
}
}
Tried to remove node_modules/
directory and after that I ran npm install
to install the dependencies again. This didn’t help.
Then I tried to get the latest version of lodash dependency npm install --save lodash@latest
, this didn’t help either.
My nodejs version is: v6.9.1
and npm version is: 4.3.0
. Also tried to add line "lodash": "^4.13.1"
in devDependencies in package.json, this had no effect.
Any ideas what is causing this and how to fix this dependency problem? I haven’t played around with nodejs+reactjs before this.
Cheers,
TeNDoLLA