不知如何是好,在執行npm run release出現了下面錯誤,不知道怎么解決,求幫助
我在使用npm run release出現了下面的問題,怎么解決
Hash: 223396e11ea7f486fa19
Version: webpack 4.19.0
Time: 293ms
Built at: 2018-09-15 13:53:24
?1 asset
Entrypoint main = ./release/bundle.js
[0] ./src/index.js 2.62 KiB {0} [built] [failed] [1 error]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-preset-es2017/lib/index.js
? ? at createDescriptor (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
? ? at items.map (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
? ? at Array.map (<anonymous>)
? ? at createDescriptors (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
? ? at createPresetDescriptors (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
? ? at presets (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
? ? at mergeChainOpts (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-chain.js:315:26)
? ? at /Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-chain.js:278:7
? ? at buildRootChain (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/config-chain.js:118:22)
? ? at loadPrivatePartialConfig (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/partial.js:57:55)
? ? at Object.loadPartialConfig (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/@babel/core/lib/config/partial.js:82:18)
? ? at Object.<anonymous> (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:105:26)
? ? at Generator.next (<anonymous>)
? ? at step (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:3:221)
? ? at _next (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:3:409)
? ? at /Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:3:477
? ? at new Promise (<anonymous>)
? ? at Object.<anonymous> (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:3:97)
? ? at Object._loader (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:183:18)
? ? at Object.loader (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:50:18)
? ? at Object.<anonymous> (/Users/123456pass/Desktop/wutiange/Simple-demining/node_modules/babel-loader/lib/index.js:45:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] release: `webpack`
npm ERR! Exit status 2
npm ERR!?
npm ERR! Failed at the [email protected] release 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! ? ? /Users/123456pass/.npm/_logs/2018-09-15T05_53_24_519Z-debug.log
2022-05-28
注意版本,和老師的版本對齊
2020-05-30
關于npm run release報錯的問題,老師怎么不出來解釋一下???
2019-07-03
在webpack.config.js中加入一個這個,
如果還報錯,請看看版本問題
npm?uninstall?babel-loader
npm?install?[email protected]
執行一下這兩個命令
你試試,我是這么解決的
2018-11-23
這個是成功的效果,注意一定要版本正確,并且不是在高版本存在的情況下,回答時期:16:59 2018/11/23
2018-11-23
本人也出現了該方法,經過半天的一步步改進,目前問題已經解決。解決方式為嚴格安裝視頻的版本走,并且不能實現重新添加,比如一步成功。
如樓上兩位的,一旦添加了新版,及時使用添加舊版,一樣報錯。
我仔細對比了版本區別:
?日期:16:54 2018/11/23
相同部分:直接運行
npm i babel-core babel-polyfill babel-preset-es2015 babel-preset-latest --save-dev --registry=https://registry.npm.taobao.org
差異部分:指定運行如下
npm i [email protected] [email protected] [email protected] --save-dev?
最終效果如下:
2018-09-27
npm i [email protected] --save-dev
2018-09-16
因為你安裝的babel-loader的版本太高了,應該是8點幾吧,改到7.1.5版就可以了。