我遇到运行grunt的问题
"Cannot find module './api"
行错误routes.js ---> image structure project app.use('/api/things', require('./api\thing'));
但是我的项目中的这个模块。 我用yo angular-fullstack创建项目。
我不明白问题是什么。 有人帮帮我吗? 有人帮我这个吗?
Running "mochaTest:unit" (mochaTest) task
>> Mocha exploded!
>> Error: Cannot find module './api hing'
>> at Function.Module._resolveFilename (module.js:336:15)
>> at Function.Module._load (module.js:278:25)
>> at Module.require (module.js:365:17)
>> at require (module.js:384:17)
>> at module.exports (C:/Users/Jonathan/Documents/bdsmeanshop/server/routes.js:13:26)
>> at Object.<anonymous> (C:/Users/Jonathan/Documents/bdsmeanshop/server/app.js:33:20)
>> at Module._compile (module.js:460:26)
>> at normalLoader (C:\Users\Jonathan\Documents\bdsmeanshop\node_modules\babel-core\lib\api\register\node.js:199:5)
>> at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Jonathan\Documents\bdsmeanshop\node_modules\babel-core\lib\api\register\node.js:216:7)
>> at Module.load (module.js:355:32)
>> at Function.Module._load (module.js:310:12)
>> at Module.require (module.js:365:17)
>> at require (module.js:384:17)
>> at Object.<anonymous> (C:/Users/Jonathan/Documents/bdsmeanshop/server/api/user/user.model.spec.js:3:11)
>> at Module._compile (module.js:460:26)
>> at normalLoader (C:\Users\Jonathan\Documents\bdsmeanshop\node_modules\babel-core\lib\api\register\node.js:199:5)
>> at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Jonathan\Documents\bdsmeanshop\node_modules\babel-core\lib\api\register\node.js:216:7)
>> at Module.load (module.js:355:32)
>> at Function.Module._load (module.js:310:12)
>> at Module.require (module.js:365:17)
>> at require (module.js:384:17)
>> at C:\Users\Jonathan\Documents\bdsmeanshop\node_modules\mocha\lib\mocha.js:220:27
Warning: Task "mochaTest:unit" failed. Use --force to continue.
Aborted due to warnings.
答案 0 :(得分:1)
将评论移至答案。
你是不是逃避了事情? app.use('/ api / things',require('./ api \ thing'));试试./api/thing。错误说无法找到'./api hing'