bem / create-bem-react-app

[deprecated] Create BEM React apps with no build configuration.
Other
25 stars 8 forks source link

Failed start command #39

Closed lilliputten closed 6 years ago

lilliputten commented 6 years ago

After installing and creating the application, an error occurs during the execution of the npm start command in node_modules/@bem/sdk.config/index.js:extendConfigsPathByLayer().

        config.levels && config.levels.forEach(level => {
                                       ^
TypeError: config.levels.forEach is not a function
    at configs.forEach.config (my-app/node_modules/@bem/sdk.config/index.js:412:40)
    at Array.forEach (native)
    at extendConfigsPathByLayer (my-app/node_modules/@bem/sdk.config/index.js:411:13)
    at BemConfig.configs (my-app/node_modules/@bem/sdk.config/index.js:55:23)
    at BemConfig.getSync (my-app/node_modules/@bem/sdk.config/index.js:258:23)
    at BemConfig.moduleSync (my-app/node_modules/@bem/sdk.config/index.js:361:24)

    at Object.<anonymous> (my-app/node_modules/bem-react-scripts/config/paths.js:17:31)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)```

The variable config.levels is expected as an array whereas when it's a hash:

{ 'src/components': { scheme: 'nested', default: true } }

In .bemrc change the parameter levels to become an array:

    "levels": [
        {
            "path": "src/components",
            "scheme": "nested",
            "default": true
        }
    ],

Next see an error:

Error: Cannot find module 'babel-preset-es2015'

Install it:

npm i -D babel-preset-es2015

Run npm start again. localhost:3000 opens in browser. Got in the browser window:

Failed to compile.

Error in ./src/index.js
Module not found: Can't resolve './componentsAppApp.css' in 'my-app/src'

 @ multi ./~/react-dev-utils/webpackHotDevClient.js ./~/bem-react-scripts/config/polyfills.js ./src/index.js

Got in the console the foloowing:

Failed to compile.

Error in ./src/index.js
Module not found: Can't resolve './componentsAppApp.css' in 'my-app/src'

 @ multi ./~/react-dev-utils/webpackHotDevClient.js ./~/bem-react-scripts/config/polyfills.js ./src/index.js

Error in ./src/index.js
Module not found: Can't resolve './componentsPagePage.css' in 'my-app/src'

 @ multi ./~/react-dev-utils/webpackHotDevClient.js ./~/bem-react-scripts/config/polyfills.js ./src/index.js

Error in ./src/index.js
Module not found: Can't resolve './componentsAppApp.js' in 'my-app/src'

 @ multi ./~/react-dev-utils/webpackHotDevClient.js ./~/bem-react-scripts/config/polyfills.js ./src/index.js

Versions:

$ npm view create-bem-react-app version
0.0.3

$ npm -v
5.5.1

$ node -v
v6.10.0

Running on Win10.

awinogradov commented 6 years ago

@Yeti-or can you help to understand the problem with bem-config?

basilred commented 6 years ago

I have exactly the same problem. macOS, node 9.3.0, npm 5.5.1.

lilliputten commented 6 years ago

Still using 0.1.2. The solution has not yet been found?

awinogradov commented 6 years ago

The current project is deprecated since we have https://github.com/bem/bem-react-boilerplate. Please try it and write some feedback for us ;)

lilliputten commented 6 years ago

@awinogradov Yes, thank you! This works fine.

innabelaya commented 6 years ago

here's the fix anyway