抛出新的TypeError('需要根路径')

时间:2017-05-10 14:35:12

标签: javascript node.js ubuntu express dokku

我正在将应用程序部署到远程服务器(dukko),并抛出此错误。 任何帮助或建议将不胜感激。

/app/node_modules/express/node_modules/serve-static/index.js:40
remote: throw new TypeError('root path required')
remote: ^
remote: TypeError: root path required
remote: at Function.serveStatic [as static] 
        (/app/node_modules/express/node_modules/serve-static/index.js:40:11)
remote: at exports.default (/app/server/config/express.js:129:57)
remote: at Object. (/app/server/app.js:51:28)
remote: at Module._compile (module.js:409:26)
remote: at Object.Module._extensions..js (module.js:416:10)
remote: at Module.load (module.js:343:32)
remote: at Function.Module._load (module.js:300:12)
remote: at Function.Module.runMain (module.js:441:10)
remote: at startup (node.js:140:18)
remote: at node.js:1043:3

我用的唯一静态路径是。

app.use(express.static(app.get('appPath')));
app.use('/jobseeker', express.static(process.env.JOBSEEKER_UPLOADS));
app.use('/employer', express.static(process.env.EMPLOYER_UPLOADS));`

1 个答案:

答案 0 :(得分:0)

您需要设置node_modules_dir