我运行了webpack并希望使用emailjs-imap-client。 可悲的是,我无法让它工作...... 我总是遇到以下错误:
[HMR] Waiting for update signal from WDS...
Uncaught Error: Cannot find module "emailjs-imap-client-imap"
[WDS] Hot Module Replacement enabled.
[WDS] Errors while compiling.
./~/emailjs-imap-client/src/emailjs-imap-client.js
Module not found: Error: Cannot resolve module 'emailjs-imap-client-imap' in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/src
resolve module emailjs-imap-client-imap in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/src
looking for modules in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules
resolve 'file' emailjs-imap-client-imap in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap doesn't exist (module as directory)
looking for modules in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules
resolve 'file' emailjs-imap-client-imap in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap doesn't exist (module as directory)
looking for modules in /home/yatekii/Projects/Yatekii.github.io/node_modules
resolve 'file' emailjs-imap-client-imap in /home/yatekii/Projects/Yatekii.github.io/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap doesn't exist (module as directory)
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.web.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap.json]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-client-imap]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.web.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap.json]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client-imap]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.web.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap.json]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-client-imap]
@ ./~/emailjs-imap-client/src/emailjs-imap-client.js 5:8-140
./~/emailjs-imap-client/~/emailjs-imap-handler/src/emailjs-imap-parser.js
Module not found: Error: Cannot resolve module 'emailjs-imap-formal-syntax' in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-handler/src
resolve module emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-handler/src
looking for modules in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules
resolve 'file' emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax doesn't exist (module as directory)
looking for modules in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules
resolve 'file' emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax doesn't exist (module as directory)
looking for modules in /home/yatekii/Projects/Yatekii.github.io/node_modules
resolve 'file' emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax doesn't exist (module as directory)
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.web.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.json]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.web.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.json]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.web.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.json]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax]
@ ./~/emailjs-imap-client/~/emailjs-imap-handler/src/emailjs-imap-parser.js 25:8-55
./~/emailjs-imap-client/~/emailjs-imap-handler/src/emailjs-imap-compiler.js
Module not found: Error: Cannot resolve module 'emailjs-imap-formal-syntax' in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-handler/src
resolve module emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-handler/src
looking for modules in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules
resolve 'file' emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax doesn't exist (module as directory)
looking for modules in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules
resolve 'file' emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax doesn't exist (module as directory)
looking for modules in /home/yatekii/Projects/Yatekii.github.io/node_modules
resolve 'file' emailjs-imap-formal-syntax in /home/yatekii/Projects/Yatekii.github.io/node_modules
resolve file
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.webpack.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.web.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.js doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.json doesn't exist
/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax doesn't exist (module as directory)
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.web.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax.json]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-client/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.web.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.js]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax.json]
[/home/yatekii/Projects/Yatekii.github.io/react-hot-boilerplate/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.webpack.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.web.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.js]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax.json]
[/home/yatekii/Projects/Yatekii.github.io/node_modules/emailjs-imap-formal-syntax]
@ ./~/emailjs-imap-client/~/emailjs-imap-handler/src/emailjs-imap-compiler.js 25:8-55
这对我来说很奇怪,因为它正在寻找尴尬地方的模块。我的npm模块位于/home/yatekii/Yatekii.github.io/react-hot-boilerplate/node_modules/。 例如,电子邮件emailjs-imap-formal-syntax在这里:./ node_modules / email_sp-client / node_modules / email_sp-handler / src / email -sp-formal-syntax.js
如何让node / webpack找到模块? :S
我在webpack-config中试过这个:
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [
{
test: 'emailjs-imap-client',
loader: "imports?define=>false"
},
{
test: 'emailjs-imap-client-imap',
loader: 'imports?define=>false',
include: 'emailjs-imap-client/src/emailjs-imap-client-imap.js')
},
{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
include: path.join(__dirname, 'src')
},
]
}
};
我刚刚收到错误:
var ImapClient = require('emailjs-imap-client');
var client = new ImapClient('mail.yatekii.ch', 143, {
auth: {
user: 'yatekii@yatekii.ch',
pass: 'VERYSECRET'
}
}
)
有人能帮助我吗?万分感谢! 和平Yatekii
答案 0 :(得分:-1)
看看我使用emailjs modules + webpack的例子:
https://github.com/Axel186/emailjs-and-webpack-example
在那里,您可以找到使用emailjs-imap-client的工作客户端示例。
无论如何,这是webpack配置文件的一部分:
...
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|forge\.js)/,
loader: 'babel-loader',
query: {
compact: true,
presets: ['es2015']
}
}]
},
alias: {
forge: 'forge.js'
},
resolve: {
root: [
// path.resolve('./src/app'),
path.resolve('./src/'),
path.resolve('./node_modules/emailjs-imap-client/src/'),
path.resolve('./node_modules/emailjs-imap-handler/src/'),
path.resolve('./node_modules/emailjs-tcp-socket/src/'),
path.resolve('./node_modules/emailjs-smtp-client/src/'),
path.resolve('./node_modules/emailjs-stringencoding/src/'),
]
},
...