我一直在遵循Webpack指南,因此卡住了
here
while running
npm run build
i received the this error:。
path.js:1086
cwd=进程.cwd();
^
错误:enent:没有这样的文件或目录,uv_w cwd
在object.resolve上(path.js:1086:25)
at function.module._resolvelookuppaths(内部/modules/cjs/loader.js:479:17)
at function.module._resolveFileName(内部/modules/cjs/loader.js:587:20)
< /代码>
我检查了所有进口商品,一切都很好。比我想象的要快取问题,所以我运行了npm cache clean-f
出人意料的是,我得到了完全相同的错误。可能是问题,但我不知道如何调试它。
这是我的文件结构:

package.json
< PRE> >代码>
“name”:“测试\u webpack”,
“version”:“1.0.0”,
“description”:“”,
“private”:对,
“脚本”:{
“test”:“echo \”错误:未指定测试\“退出1”,
“build”:“Webpack”
}
“关键词”:
“作者”:“
“license”:“isc”,
“devdependencies”:。{
“clean webpack plugin”:“^1.0.0”,
“css loader”:“^1.0.1”,
“csv loader”:“^3.0.2”,
“文件加载器”:“^2.0.0”,
“html webpack plugin”:“^3.2.0”,
“样式加载器”:“^0.23.1”,
“webpack”:“^4.25.1”,
“webpack cli”:“^3.1.2”,
“XML加载程序”:“^1.2.1”
}
“依赖项”:。{
“lodash”:“^4.17.11”
}
}
webpack.config.js
const path=require('path');
const html webpack plugin=需要('html-webpack-plugin')
const clean webpack plugin=需要(“clean-webpack-plugin”)
模块.导出={
模式:'开发',
条目:{
应用程序:'./src/index.js',
打印:'./src/print.js',
秒:'./src/secondclick.js'
}
devtool:'内联源映射',
插件:
新建CleanWebPackPlugin(['dist']),
新建htmlwebpackplugin({
Titile:“WebpackN12的输出管理器”
})
,
输出:{
文件名:“[name].bundle.js”,
路径:path.resolve(u dirname,'dist')
}
};
< /代码> <跑步时npm run build
我收到这个错误:
path.js:1086
cwd = process.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at Object.resolve (path.js:1086:25)
at Function.Module._resolveLookupPaths (internal/modules/cjs/loader.js:479:17)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:20)
我检查了所有进口商品,一切都很好。比我想象的要快的多,所以我跑了npm cache clean -f
令人惊讶的是,我得到了完全相同的错误。可能是诺迪斯但我不知道如何调试它。
这是我的文件结构:

包装袋
{
"name": "test_webpack",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"clean-webpack-plugin": "^1.0.0",
"css-loader": "^1.0.1",
"csv-loader": "^3.0.2",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"xml-loader": "^1.2.1"
},
"dependencies": {
"lodash": "^4.17.11"
}
}
web包.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
module.exports = {
mode: 'development',
entry: {
app: './src/index.js',
print: './src/print.js',
sec: './src/secondClick.js'
},
devtool: 'inline-source-map',
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
titile: "Output manager from webpack n12"
})
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
}
};