npmjs上的库在creator2.4.5上使用没问题,到3.1.0上报错

import { _decorator, Component, Node } from ‘cc’;

const { ccclass, property } = _decorator;

import * as StateMachine from “javascript-state-machine”;

@ccclass(‘State2Test’)

export class State2Test extends Component {

start () {

    

    var fsm = StateMachine.create({

        initial: 'solid',

        events: [

          { name: 'melt',     from: 'solid',  to: 'liquid' },

          { name: 'freeze',   from: 'liquid', to: 'solid'  },

          { name: 'vaporize', from: 'liquid', to: 'gas'    },

          { name: 'condense', from: 'gas',    to: 'liquid' }

        ],

        callbacks: {

          onMelt:     function() { console.log('I melted')    },

          onFreeze:   function() { console.log('I froze')     },

          onVaporize: function() { console.log('I vaporized') },

          onCondense: function() { console.log('I condensed') }

        }

    });

    fsm.melt();

}

}
说debug.ts:102 TypeError: StateMachine.create is not a function

我今天在3.1.2上也碰到这问题不知道咋弄,请问有解决吗