1

Just did a refresh of my computer but now Im having trouble running my code....

When running "npm start" I get the following error:

> ERROR in ./~/react-dom/lib/CSSPropertyOperations.js Module not found:
> Error: Can't resolve 'fbjs/lib/memoi zeStringOnly' in
> 'C:\Code\Project.Web\node_modules\react-dom\lib'
> @ ./~/react-dom/lib/CSSPropertyOperations.js 20:24-61  
> @ ./~/react-dom/lib/ReactDOMComponent.js  @
> ./~/react-dom/lib/ReactDefaultInjection.js  @
> ./~/react-dom/lib/ReactDOM.js  @ ./~/react-dom/index.js  @
> ./source/components/index.js  @ multi
> (webpack)-dev-server/client?http://0.0.0.0:30 00
> webpack/hot/dev-server ./index.js

I tried to update all packages but got same error...

Here is my package.json file:

{
  "name": "homecore.web",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "webpack-dashboard -t 'HomeCore' -- webpack-dev-server --colors --no-info",
    "build": "rm -rf ./build && NODE_ENV=\"production\" webpack",
    "lint-break-on-errors": "eslint ./source/js ./webpack.config.js -f table --ext .js --ext .jsx",
    "lint": "eslint ./source/js ./webpack.config.js -f table --ext .js --ext .jsx || true",
    "preview": "NODE_ENV=\"production\" webpack-dashboard -t 'Preview Mode - React-Redux Boilerplate' -- webpack-dev-server",
    "hook-add": "prepush install",
    "hook-remove": "prepush remove"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "autoprefixer": "^6.7.7",
    "babel-core": "^6.24.1",
    "babel-eslint": "^7.2.3",
    "babel-loader": "^7.0.0",
    "babel-plugin-syntax-decorators": "^6.13.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-react-hmre": "^1.1.1",
    "babel-preset-stage-0": "^6.24.1",
    "babel-runtime": "^6.23.0",
    "css-loader": "0.28.1",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^14.1.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^4.0.0",
    "eslint-plugin-react": "^6.10.3",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.11.1",
    "html-webpack-plugin": "^2.28.0",
    "less": "^2.7.2",
    "less-loader": "^4.0.3",
    "postcss-loader": "^1.3.3",
    "prepush": "^3.1.11",
    "style-loader": "^0.17.0",
    "url-loader": "^0.5.8",
    "webpack": "^2.4.1",
    "webpack-dashboard": "^0.4.0",
    "webpack-dev-server": "^2.4.5"
  },
  "dependencies": {
    "alt": "0.18.6",
    "alt-utils": "^1.0.0",
    "babel-polyfill": "^6.23.0",
    "es6-promise": "^4.1.0",
    "immutable": "^3.8.1",
    "isomorphic-fetch": "^2.2.1",
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "react-router": "^4.1.1",
    "react-router-dom": "^4.1.1",
    "semantic-ui-react": "^0.68.2",
    "whatwg-fetch": "^2.0.3"
  },
  "prepush": [
    "npm run lint-break-on-errors --silent"
  ]
}
D3athSpank
  • 159
  • 1
  • 1
  • 9

3 Answers3

0

Ok so after a lot of googleing, I found a work around. Im still not sure why i get this error.

But according to this post there is a way to add alias in webpack.

So i added this to my webpack.config.js

var alias = {};
alias['fbjs/lib/memoizeStringOnly'] = '../node_modules/fbjs/lib/memoizeStringOnly';
module.exports = {
  .
  .
  alias : alias,
  .
  .
}

and now it works!

But, and now Im guessing, some package must be broken trying to access this component from the wrong location

Community
  • 1
  • 1
D3athSpank
  • 159
  • 1
  • 1
  • 9
0

Within the last week or so, I've run into the same issue but with react-dom@15.4.2 instead of react-dom@15.5.4. What I think I've found to be the issue is that Webpack isn't able to resolve the fbjs dependency within the react-dom/node_modules directory.

For me, I was able to solve the issue by including the fbjs package as an explicit dependency in the package.json. Now instead of the project-level dependency linking to the peer of react-dom, the module in react-dom links to the project-level module.

Now, I don't think this is necessarily the right solution, especially if you allow minor version bumps with '~' and '^' in your package.json, but because we are only updating our dependencies when we need to by hand, our team is comfortable specifying the version of fbjs.

Snippet of our package.json:

"dependencies": {
    "assets-webpack-plugin": "3.5.1", 
    "babel-core": "6.24.0",
    "babel-loader": "6.4.1",
    "babel-preset-es2015": "6.24.0",
    "babel-preset-react": "6.23.0",
    "css-loader": "0.26.4",
    "del": "2.2.2",
    "es6-promise": "4.1.0",  
    "fbjs": "0.8.12",
    "file-loader": "0.10.1",
    "flux": "2.1.1",
    "highcharts": "5.0.10",
    "imports-loader": "0.7.1", 
    "jquery": "2.1.3",  
    "keymirror": "0.1.1", 
    "lodash": "3.10.1",
    "lodash.clonedeep": "4.5.0",
    "material-design-icons": "2.2.3",
    "material-ui": "0.17.1",
    "moment": "2.18.1", 
    "object-assign": "4.1.1", 
    "postcss-loader": "1.3.3", 
    "rc-progress": "2.1.0",
    "react": "15.4.2",
    "react-addons-perf": "15.4.2",
    "react-data-grid": "1.0.85",
    "react-dom": "15.4.2",
    "react-highcharts": "11.5.0",
    "react-router": "3.0.3", 
    "react-tap-event-plugin": "2.0.1", 
    "sass-loader": "6.0.3",
    "style-loader": "0.13.2",
    "superagent": "3.5.2",
    "underscore": "1.8.3",
    "url-loader": "0.5.8",
    "webpack": "2.4.1"
},
Zach
  • 41
  • 3
0

I ran into this error as well after uninstalling a package. It seems fbjs was somehow removed as well, even though other packages still depended on it.

I fixed it by manually installing fbjs with npm install fbjs --save

Ryan
  • 1,142
  • 8
  • 6