mean.io assetmanager.init(… returns JS error

自古美人都是妖i 提交于 2019-12-11 03:55:41

问题


I want to use MEAN.io stack. I did the required initialization. Created the folder, did the npm install, got the libraries.

now in server/config/express.js I have

assetmanager = require('assetmanager'),

and

// 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'
});

and this gives me this error:

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...

I have the package installed.

npm info assetmanager version
0.1.3

回答1:


The author mistakenly published an incompatible version of assetmanager. You can either use version v0.1.2 instead by running npm install assetmanager@0.1.2 command.

Or change your code to be compatible with the latest. Check the README for the example.




回答2:


Farid is correct that assestmanager pushed out an incompatable version.

The mean.io project has since been updated to use the 0.1.2 version. Commit

All new mean.io projects will have the correct version.

For projects that do not work you can either change your package.json or manually run npm install assetmanager@0.1.2

Please note that it is recommended to rather update your package.json to prevent issues when you change environments or go to production.



来源:https://stackoverflow.com/questions/23949772/mean-io-assetmanager-init-returns-js-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!