为了账号安全,请及时绑定邮箱和手机立即绑定

miProject@1.0.0 build: `webpack --config webpack.config.js`

D:\miProject>npm run build


> miProject@1.0.0 build D:\miProject

> webpack --config webpack.config.js


D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\cli.js:93

                                throw err;

                                ^


ReferenceError: _dirname is not defined

    at Object.<anonymous> (D:\miProject\webpack.config.js:7:27)

    at Module._compile (D:\miProject\node_modules\_v8-compile-cache@2.1.1@v8-compile-cache\v8-compile-cache.js:194:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)

    at Module.load (internal/modules/cjs/loader.js:1049:32)

    at Function.Module._load (internal/modules/cjs/loader.js:937:14)

    at Module.require (internal/modules/cjs/loader.js:1089:19)

    at require (D:\miProject\node_modules\_v8-compile-cache@2.1.1@v8-compile-cache\v8-compile-cache.js:161:20)

    at WEBPACK_OPTIONS (D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\utils\convert-argv.js:114:13)

    at requireConfig (D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\utils\convert-argv.js:116:6)

    at D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\utils\convert-argv.js:123:17

    at Array.forEach (<anonymous>)

    at module.exports (D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\utils\convert-argv.js:121:15)

    at D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\cli.js:71:45

    at Object.parse (D:\miProject\node_modules\_yargs@13.3.2@yargs\yargs.js:576:18)

    at D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\cli.js:49:8

    at Object.<anonymous> (D:\miProject\node_modules\_webpack-cli@3.3.12@webpack-cli\bin\cli.js:366:3)

    at Module._compile (internal/modules/cjs/loader.js:1200:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)

    at Module.load (internal/modules/cjs/loader.js:1049:32)

    at Function.Module._load (internal/modules/cjs/loader.js:937:14)

    at Module.require (internal/modules/cjs/loader.js:1089:19)

    at require (internal/modules/cjs/helpers.js:73:18)

    at Object.<anonymous> (D:\miProject\node_modules\_webpack@4.43.0@webpack\bin\webpack.js:156:2)

    at Module._compile (internal/modules/cjs/loader.js:1200:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)

    at Module.load (internal/modules/cjs/loader.js:1049:32)

    at Function.Module._load (internal/modules/cjs/loader.js:937:14)

    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)

    at internal/main/run_main_module.js:17:47

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! miProject@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the miProject@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\msi\AppData\Roaming\npm-cache\_logs\2020-07-07T07_43_53_534Z-debug.log


D:\miProject>


正在回答

1 回答

试试__dirname,少了一个下划线

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
TypeScript封装播放器组件
  • 参与学习       7964    人
  • 解答问题       60    个

手把手教大家进行需求分析、组织代码,并使用组件化编写高性能代码。

进入课程

miProject@1.0.0 build: `webpack --config webpack.config.js`

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信