Storybook: TypeError: Cannot read property 'bindings' of null

Created on 31 Jul 2018  ·  10Comments  ·  Source: storybookjs/storybook

If you are reporting a bug or requesting support, start here:

Bug or support request summary

After I installed storybook into a VueJS project that was created with the VueCli, whenever I try and run my Vue project with "yarn serve" I get the following error:

TypeError: Cannot read property 'bindings' of null

The project no longer works.

The full error message is:

`Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: Cannot read property 'bindings' of null
at Scope.moveBindingTo (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/scope/index.js:978:13)
at BlockScoping.updateScopeInfo (/vagrant/Apps/Conv Wizard/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17)
at BlockScoping.run (/vagrant/Apps/Conv Wizard/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12)
at PluginPass.BlockStatementSwitchStatementProgram (/vagrant/Apps/Conv Wizard/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24)
at newFn (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/visitors.js:237:21)
at NodePath._call (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/path/context.js:65:20)
at NodePath.call (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/path/context.js:100:12)
at TraversalContext.visitQueue (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/context.js:142:16)
at TraversalContext.visitSingle (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/context.js:102:19)
at TraversalContext.visit (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/context.js:182:19)
at Function.traverse.node (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/index.js:106:17)
at traverse (/vagrant/Apps/Conv Wizard/node_modules/@babel/traverse/lib/index.js:76:12)
at transformFile (/vagrant/Apps/Conv Wizard/node_modules/@babel/core/lib/transformation/index.js:116:29)
at runSync (/vagrant/Apps/Conv Wizard/node_modules/@babel/core/lib/transformation/index.js:45:3)
at runAsync (/vagrant/Apps/Conv Wizard/node_modules/@babel/core/lib/transformation/index.js:35:14)

@ multi (webpack)-dev-server/client?http://10.0.2.15:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.tss`

Steps to reproduce

Use the latest VueCli to create a project with Typescript support.
Install storybook via the cli. Note, I had to create a custom webpack.config.js file to get around a VueLoader error:

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = (baseConfig, env, defaultConfig) => {
defaultConfig.plugins.push(new VueLoaderPlugin());
return defaultConfig;
};

Attempt to start the server. You should get the error above.

Please specify which version of Storybook and optionally any affected addons that you're running

Latest version of Storybook.

Package.json is as follows:
{
"name": "moveit",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.0",
"@fortawesome/free-solid-svg-icons": "^5.1.0",
"@fortawesome/pro-light-svg-icons": "^5.1.0",
"@fortawesome/vue-fontawesome": "^0.1.0",
"axios": "^0.18.0",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.16",
"vue-multiselect": "^2.1.0",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-persist": "^1.4.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.0-beta.15",
"@vue/cli-plugin-typescript": "^3.0.0-beta.15",
"@vue/cli-service": "^3.0.0-beta.15",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.3",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vue-template-compiler": "^2.5.16"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

vue inactive question / support

Most helpful comment

After doing some digging (and reading this issue thread over on the Babel repository https://github.com/babel/babel/issues/7627), it appears that this error is caused by a miss-match in Babel version (v6 vs v7).

I was able to solve the issue with the following changes:

package.json:

  • remove babel-core: 7.0.0-bridge.0
  • install @babel/core (as of writing this comment, 7.0.0-beta.56 is the latest)
  • install @babel//preset-env (as of writing this comment, 7.0.0-beta.56 is the latest)
    (note that it is important that the two Babel dependencies match in version)

.babel.rc: delete this file

babel.config.js

  • add @babel/preset-env to the presets array

(all this was done using Vue CLI v3.0.0-rc.12 and Storybook CLI 4.0.0-alpha.16)

pro tip: if you don't see any change in behaviour, try deleting your node_modules as well as package-lock.json file before running npm install

All 10 comments

I'm running in to the same issue related to babel-loaderwith a project generated using the the new Vue CLI v3.0.0-rc.12 and Storybook CLI 4.0.0-alpha.16

After doing some digging (and reading this issue thread over on the Babel repository https://github.com/babel/babel/issues/7627), it appears that this error is caused by a miss-match in Babel version (v6 vs v7).

I was able to solve the issue with the following changes:

package.json:

  • remove babel-core: 7.0.0-bridge.0
  • install @babel/core (as of writing this comment, 7.0.0-beta.56 is the latest)
  • install @babel//preset-env (as of writing this comment, 7.0.0-beta.56 is the latest)
    (note that it is important that the two Babel dependencies match in version)

.babel.rc: delete this file

babel.config.js

  • add @babel/preset-env to the presets array

(all this was done using Vue CLI v3.0.0-rc.12 and Storybook CLI 4.0.0-alpha.16)

pro tip: if you don't see any change in behaviour, try deleting your node_modules as well as package-lock.json file before running npm install

@morficus do you mind sharing your package.json, your babel.config.js, and any other relevant configuration files?

Removing babel-core bridge gives me the following error:
Error: Plugin 0 specified in "node_modules/@vue/babel-preset-app/index.js" provided an invalid property of "default"

Which I assume has to do with storybook using babel 6

@tamara-bain Here is my package.json file (I recently moved up to using Babel 7 RC1 and Vue CLI 3 [official release])

{
  "name": "ui-shared-components",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "lint": "vue-cli-service lint",
    "test:unit": "vue-cli-service test:unit",
    "test:e2e": "vue-cli-service test:e2e",
    "start": "start-storybook -p 6006",
    "build": "build-storybook -c .storybook -o dist"
  },
  "dependencies": {
    "semantic-ui-css": "^2.3.3",
    "semantic-ui-vue": "^0.3.3",
    "vue": "^2.5.17"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0-rc.1",
    "@babel/preset-env": "^7.0.0-rc.1",
    "@storybook/addon-actions": "^4.0.0-alpha.16",
    "@storybook/addon-centered": "^4.0.0-alpha.16",
    "@storybook/addon-console": "^1.0.4",
    "@storybook/addon-knobs": "^4.0.0-alpha.16",
    "@storybook/addon-links": "^4.0.0-alpha.16",
    "@storybook/addon-options": "^4.0.0-alpha.16",
    "@storybook/addons": "^4.0.0-alpha.16",
    "@storybook/vue": "^4.0.0-alpha.16",
    "@vue/cli-plugin-babel": "^3.0.0",
    "@vue/cli-plugin-e2e-cypress": "^3.0.0",
    "@vue/cli-plugin-eslint": "^3.0.0",
    "@vue/cli-plugin-unit-jest": "^3.0.0",
    "@vue/cli-service": "^3.0.0",
    "@vue/eslint-config-prettier": "^3.0.0",
    "@vue/test-utils": "^1.0.0-beta.24",
    "babel-jest": "^23.4.2",
    "babel-preset-vue": "^2.0.2",
    "moment": "^2.22.2",
    "node-sass": "^4.9.3",
    "sass-loader": "^7.1.0",
    "storybook-readme": "^3.3.0",
    "vue-template-compiler": "^2.5.17"
  }
}

(I have moment.js in there because of a strange dependency bug with one of the Storybook ad-ons...)

edit:
this is unrelated, but in case anyone tries to use this package.json verbatim.... the following webpack.config.js is needed inside your .storybook dir:

module.exports = (storybookBaseConfig, configType, defaultConfig) => {
  defaultConfig.module.rules.push({
    test: /\.scss$/,
    use: [require.resolve('style-loader'), require.resolve('css-loader'), require.resolve('sass-loader')],
  });

  return defaultConfig;
};

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@morficus Your solution was dead on for my use case (which was identical to yours in that I had generated a project via vue-cli@3). Thank you!

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

How to fix this file?
package.json

{
"name": "mstore",
"description": "MStore Pro - Complete React Native template for e-commerce",
"author": "InpireUI",
"version": "3.6.0",
"private": true,
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"setup": "./scripts/setup.sh",
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"api-ecommerce": "^0.0.16",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-env": "^1.7.0",
"base-64": "^0.1.0",
"create-react-context": "^0.2.3",
"currency-formatter": "^1.4.2",
"expo": "^31.0.4",
"firebase": "5.5.9",
"html-entities": "^1.2.1",
"lodash": "4.17.11",
"moment": "2.22.2",
"monet": "0.9.0",
"oauth-1.0a": "1.0.1",
"path": "^0.12.7",
"react": "16.5.0",
"react-instantsearch": "^5.1.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz",
"react-native-animatable": "^1.3.0",
"react-native-app-intro-slider": "1.0.1",
"react-native-collapsible": "1.3.0",
"react-native-country-picker-modal": "^0.6.2",
"react-native-drawer": "https://github.com/luyx2412/react-native-drawer.git",
"react-native-fluid-slider": "^1.0.2",
"react-native-keyboard-aware-scroll-view": "^0.7.2",
"react-native-masked-text": "^1.9.2",
"react-native-modalbox": "1.6.0",
"react-native-paper": "^2.1.1",
"react-native-parallax": "^0.3.0",
"react-native-radio-buttons": "^1.0.0",
"react-native-render-html": "3.10.0",
"react-native-scrollable-tab-view": "0.10.0",
"react-native-side-menu": "^1.1.3",
"react-native-snap-carousel": "^3.6.0",
"react-native-star-rating": "^1.0.9",
"react-native-swipe-list-view": "1.5.0",
"react-native-swiper": "^1.5.13",
"react-navigation": "^2.18.2",
"react-navigation-header-buttons": "^2.1.0",
"react-navigation-props-mapper": "^0.3.0",
"react-redux": "5.1.1",
"redux": "^4.0.0",
"redux-persist": "^5.9.1",
"redux-thunk": "^2.3.0",
"reselect": "4.0.0",
"tcomb-form-native": "^0.6.13",
"urijs": "1.19.1",
"url": "^0.11.0",
"url-parse": "1.4.4",
"util": "0.11.1",
"uuid": "3.3.2",
"validate.js": "^0.12.0",
"wpapi": "^1.1.2"
},
"devDependencies": {
"babel-jest": "^23.0.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-preset-expo": "^5.0.0",
"babel-preset-react-native": "4.0.1",
"jest": "^23.1.0",
"reactotron-react-native": "2.1.0",
"reactotron-redux": "2.1.0"
}
}


I show this error when I run expo cli:

The development server returned response error code: 500 URL: 192.168.56.1:19001/node_modules/expo/… Body: {"type":"TransformError","lineNumber":0,"errors":[{"description":"C:\Repos\mstore-3.6.4\mstore-expo\App.js: Cannot read property 'bindings' of null","lineNumber":0}],"name":"SyntaxError","message":"C:\Repos\mstore-3.6.4\mstore-expo\App.js

App.js

/** @format */

import React from "react";
import { Image } from "react-native";
import { Images, Config, Theme } from "@common";
import { AppLoading, Asset, Font } from "@expo";
import { Provider } from "react-redux";
import { persistStore } from "redux-persist";
import { PersistGate } from "redux-persist/es/integration/react";
import { WooWorker } from "api-ecommerce";
import store from "@store/configureStore";
import RootRouter from "./src/Router";
import "./ReactotronConfig";
import {Provider as PaperProvider } from "react-native-paper";

function cacheImages(images) {
return images.map((image) => {
if (typeof image === "string") {
return Image.prefetch(image);
}
return Asset.fromModule(image).downloadAsync();
});
}

function cacheFonts(fonts) {
return fonts.map((font) => Font.loadAsync(font));
}

export default class App extends React.Component {
state = { appIsReady: false };

componentDidMount() {
WooWorker.init({
url: Config.WooCommerce.url,
consumerKey: Config.WooCommerce.consumerKey,
consumerSecret: Config.WooCommerce.consumerSecret,
wp_api: true,
version: "wc/v2",
queryStringAuth: true,
});
}

loadAssets = async () => {
const fontAssets = cacheFonts([
{ OpenSans: require("@assets/fonts/OpenSans-Regular.ttf") },
{ Baloo: require("@assets/fonts/Baloo-Regular.ttf") },

  { Entypo: require("@expo/vector-icons/fonts/Entypo.ttf") },
  {
    "Material Icons": require("@expo/vector-icons/fonts/MaterialIcons.ttf"),
  },
  {
    MaterialCommunityIcons: require("@expo/vector-icons/fonts/MaterialCommunityIcons.ttf"),
  },
  {
    "Material Design Icons": require("@expo/vector-icons/fonts/MaterialCommunityIcons.ttf"),
  },
  { FontAwesome: require("@expo/vector-icons/fonts/FontAwesome.ttf") },
  {
    "simple-line-icons": require("@expo/vector-icons/fonts/SimpleLineIcons.ttf"),
  },
  { Ionicons: require("@expo/vector-icons/fonts/Ionicons.ttf") },
]);

const imageAssets = cacheImages([
  Images.icons.iconCard,
  Images.icons.iconColumn,
  Images.icons.iconLeft,
  Images.icons.iconRight,
  Images.icons.iconThree,
  Images.icons.iconAdvance,
  Images.icons.iconHorizal,
  Images.icons.back,
  Images.icons.home,
  Images.IconSwitch,
  Images.IconFilter,
  Images.IconList,
  Images.IconGrid,
  Images.IconCard,
  Images.IconSearch,
  Images.IconHome,
  Images.IconCategory,
  Images.IconHeart,
  Images.IconOrder,
  Images.IconCart,
]);

await Promise.all([...fontAssets]);

};

render() {
const persistor = persistStore(store);

if (!this.state.appIsReady) {
  return (
    <AppLoading
      startAsync={this.loadAssets}
      onFinish={() => this.setState({ appIsReady: true })}
    />
  );
}

return (
  <Provider store={store} >
    <PersistGate persistor={persistor}>
      <PaperProvider theme={Config.Theme.isDark ? Theme.dark : Theme.light}>
        <RootRouter />
      </PaperProvider>
    </PersistGate>
  </Provider>
);

}
}

show error on this page:

error: C:\Repos\mstore-3.6.4\mstore-expo\node_modules\expo\build\environment\logging.js: Cannot read property 'bindings' of null

logging.js

import { Constants } from 'expo-constants';
import Logs from '../logs/Logs';
import RemoteLogging from '../logs/RemoteLogging';
if (Constants.manifest && Constants.manifest.logUrl) {
// Enable logging to the Expo dev tools only if this JS is not running in a web browser (ex: the
// remote debugger)
if (!navigator.hasOwnProperty('userAgent')) {
Logs.enableExpoCliLogging();
}
else {
RemoteLogging.enqueueRemoteLogAsync('info', {}, [
'You are now debugging remotely; check your browser console for your application logs.',
]);
}
}
// NOTE(2018-10-29): temporarily filter out cyclic dependency warnings here since they are noisy and
// each warning symbolicates a stack trace, which is slow when there are many warnings
const originalWarn = console.warn;
console.warn = function warn(...args) {
if (args.length > 0 &&
typeof args[0] === 'string' &&
/^Require cycle: .*node_modules/.test(args[0])) {
return;
}
originalWarn.apply(console, args);
};
//# sourceMappingURL=logging.js.map

Was this page helpful?
4 / 5 - 1 ratings

Related issues

arunoda picture arunoda  ·  3Comments

shilman picture shilman  ·  3Comments

rpersaud picture rpersaud  ·  3Comments

tlrobinson picture tlrobinson  ·  3Comments

wahengchang picture wahengchang  ·  3Comments