【问题标题】:mean.io assetmanager.init(... returns JS errormean.io assetmanager.init(... 返回 JS 错误
【发布时间】:2014-07-19 22:17:25
【问题描述】:

我想使用 MEAN.io 堆栈。我做了所需的初始化。创建文件夹,安装 npm,获取库。

现在在 server/config/express.js 我有

assetmanager = require('assetmanager'),

// Import your asset file
var assets = require('./assets.json');
assetmanager.init({ // this is line 75
    js: assets.js,
    css: assets.css,
    debug: (process.env.NODE_ENV !== 'production'),
    webroot: 'public/public'
});

这给了我这个错误:

server/config/express.js:75
assetmanager.init({
             ^
TypeError: Object #<Object> has no method 'init'
    at module.exports (server/config/express.js:75:18)
    at module.exports (server/config/system/bootstrap.js:49:48)
    at Object.<anonymous> (server.js:20:54)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
[nodemon] app crashed - waiting for file changes before starting...

我已经安装了包。

npm info assetmanager version
0.1.3

【问题讨论】:

    标签: javascript node.js express mean-stack


    【解决方案1】:

    作者mistakenly published an incompatible version of assetmanager。您可以通过运行 npm install assetmanager@0.1.2 命令来使用 v0.1.2 版本。

    或者更改您的代码以与最新版本兼容。 Check the README for the example.

    【讨论】:

    • 谢谢,我把init改成process并更新到1.0.0版了。
    【解决方案2】:

    Farid 是正确的,assestmanager 推出了不兼容的版本。

    mean.io 项目已更新为使用 0.1.2 版本。 Commit

    所有新的 mean.io 项目都将具有正确的版本。

    对于不起作用的项目,您可以更改 package.json 或手动运行 npm install assetmanager@0.1.2

    请注意,建议您更新您的 package.json 以防止在您更改环境或投入生产时出现问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-15
      • 2017-03-21
      • 2018-09-25
      • 1970-01-01
      • 2015-07-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多