SailsJs Invalid module error

浪子不回头ぞ 提交于 2019-12-11 13:47:33

问题


After I installed lodash or async plug-ins, Console shows those error messages when I launch sails.js. but I don't know what cause those error messages.

I need to solve this problem. please anyone help me.

error: A hook (`userconfig`) failed to load!

error: Error: Invalid module:[object Object]

at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15

at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:2105:15)

at Function.forEach (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:3302:9)

at buildDictionary (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:74:4)

at Function.module.exports.aggregate (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)

at Array.loadOtherConfigFiles [as 0] (/Users/johndo/github/sails/testProject/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)

at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:459:38

at Array.forEach (native)

at _each (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:32:24)

at Object.async.auto (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:430:9) [Error: Invalid module:[object Object]]

error: Error: Invalid module:[object Object]

at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15

at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:2105:15)

at Function.forEach (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:3302:9)

at buildDictionary (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:74:4)

at Function.module.exports.aggregate (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)

at Array.loadOtherConfigFiles [as 0] (/Users/johndo/github/sails/testProject/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)

at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:459:38

at Array.forEach (native)

at _each (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:32:24)

at Object.async.auto (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:430:9) [Error: Invalid module:[object Object]]

回答1:


It looks like it's experiencing an error while parsing your configuration files. Try rolling back your changes.

Also, lodash and async come as globals in sails, so you don't need to install them. Just go to config/globals and uncomment _(lodash). That might fix your problem, as maybe sails is having a conflict between its installed version and yours.



来源:https://stackoverflow.com/questions/27380678/sailsjs-invalid-module-error

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