NPM,節點的WebPack版本的WebPack modules.export沒有定義
C:\>npm --version
5.3.0
C:\>node --version
v6.10.2
C:\>webpack --version
3.3.0
我創建標準斯卡拉/ Play2項目。其中,我在app/ts文件夾中添加了4個Typescript文件(Angular)。我也創建了以下的WebPack配置文件
modules.export = {
entry: [
'/ts/main.ts',
'/ts/vendor.ts'
],
output:{
filename:'[name].bundle.js'
},
rules:
{
test:'/\.ts$/',
loader:'awesome-typescript-loader'
}
}
爲了使事情運行(下載的依賴關係和執行的WebPack到TS轉換爲JS),我編輯的遊戲配置,並在「推出前」部分增加了兩個NPM命令(見圖)。但在運行的應用程序,故宮開始宣告錯誤模塊沒有定義(指的modules.export在webpack.config.js語句)
在的IntelliJ控制檯
"C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run start --scripts-prepend-node-path=auto
> [email protected] start C:\Users\Manu\Documents\manu\programs\scala\play_programs\temp\app
> webpack
C:\Users\Manu\Documents\manu\programs\scala\play_programs\temp\app\webpack.config.js:3
modules.export = {
^
ReferenceError: modules is not defined
at Object.<anonymous> (C:\Users\Manu\Documents\manu\programs\scala\play_programs\temp\app\webpack.config.js:3:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at requireConfig (C:\Users\Manu\Documents\manu\programs\scala\play_programs\temp\app\node_modules\webpack\bin\convert-argv.js:96:18)
at C:\Users\Manu\Documents\manu\programs\scala\play_programs\temp\app\node_modules\webpack\bin\convert-argv.js:109:17
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start" "--scripts-prepend-node-path=auto"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'webpack'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-webpack package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-webpack
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-webpack
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Manu\Documents\manu\programs\scala\play_programs\temp\app\npm-debug.log
Process finished with exit code 1
僅供參考nodejs現在穩定在版本8,npm在版本5時帶來了很大的性能改進:[考慮升級](https://nodejs.org/)。 – msanford