define is not defined Javascript Node

前端 未结 1 1302
臣服心动
臣服心动 2021-02-19 11:23

I am trying to run a Javascript file with Node to post blog updates to Tumblr.

So far in my main.js file I have this:

// Tumblr Information
var tumblr =         


        
1条回答
  •  一生所求
    2021-02-19 12:09

    It looks like you are trying to load a library that is coded according to the AMD (Asynchronous Module Definition) pattern, which Node does not support natively. It is perfectly possible for the author of a library to write such library so that it can be loaded in Node. The users of the library have to extend Node's module loading capabilities to understand AMD in order to load such library.

    There are multiple loaders you can use, the one I use is amd-loader. Once installed with npm, you just add

    require("amd-loader");
    

    before you load any AMD module.

    0 讨论(0)
提交回复
热议问题