Npm ne razumijem grešku

Pozdrav,

radim s webpackom i iz čistog mira mi se pojavila greška kod naredbe “npm run build:prod”

Log u consoli mi izgleda ovako:

> trebovanje@1.0.0 build:prod C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje
> webpack --config webpack.prod.js

clean-webpack-plugin: C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\dist has been removed.
internal/child_process.js:328
    throw errnoException(err, 'spawn');
    ^

Error: spawn ENAMETOOLONG
    at exports._errnoException (util.js:1020:11)
    at ChildProcess.spawn (internal/child_process.js:328:11)
    at exports.spawn (child_process.js:369:9)
    at Object.exports.execFile (child_process.js:137:15)
    at Object.module.exports.fileCommand (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\node-notifier\lib\utils.js:69:13)
    at WindowsToaster.notify (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\node-notifier\notifiers\toaster.js:94:9)
    at WebpackNotifierPlugin.compilationDone (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack-notifier\index.js:77:18)
    at Compiler.applyPlugins (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\tapable\lib\Tapable.js:61:14)
    at emitRecords.err (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\Compiler.js:264:11)
    at Compiler.emitRecords (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\Compiler.js:371:38)
    at emitAssets.err (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\Compiler.js:258:10)
    at applyPluginsAsyncSeries1.err (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\Compiler.js:364:12)
    at next (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\tapable\lib\Tapable.js:218:11)
    at Compiler.compiler.plugin (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\tapable\lib\Tapable.js:222:13)
    at Compiler.afterEmit (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\Compiler.js:361:9)
    at require.forEach.err (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\lib\Compiler.js:350:15)
    at C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\node_modules\async\dist\async.js:473:16
    at iteratorCallback (C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\node_modules\async\dist\async.js:1064:13)
    at C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\node_modules\async\dist\async.js:969:16
    at C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\cacache\node_modules\graceful-fs\graceful-fs.js:43:10
    at C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\webpack\node_modules\graceful-fs\graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! trebovanje@1.0.0 build:prod: `webpack --config webpack.prod.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the trebovanje@1.0.0 build:prod 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\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm-cache\_logs\2018-10-15T14_17_59_526Z-debug.log

…a ja baš nemam ideju od kuda krenuti i što bi to moglo biti?
Probao sam restartat komp, heh… jer greška se pojavila samo tako …do jučer sam normalno trigirao naredbu “build:prod”. …restart nije očito pomogao.

“npm run build:dev” odradi svoj posao bez greške.

Inače, naredbe dev i prod mi povezane da trigiraju:
"scripts": { "build:dev": "webpack --config webpack.dev.js", "build:prod": "webpack --config webpack.prod.js", },

Mogao bi sada dalje keljiti što mi je kako definirano…da ne odem predaleko za sad …jel netko ima ideju od kuda krenuti / ili o čemu se radi?

Hvala.

Šta zanimljivo ima u ovom fajlu?

Probaj iskuljuciti clean-webpack-plugin, pa vidi da li ce onda build raditi.

Bilo bi dobro da nam proslijedis webpack.prod.js file.

I da nisi slucajno radio upgrade NodeJS-a ?

Nisam htio u startu s previše teksta poplašiti sve da pročitaju :smiley: , debug log kaže ovako (meni i dalje sve nepoznanice):

0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Users\\bozidar.DESKTOP-F6J3TPV\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'build:prod' ] 2 info using npm@5.5.1 3 info using node@v6.11.5 4 verbose run-script [ 'prebuild:prod', 'build:prod', 'postbuild:prod' ] 5 info lifecycle trebovanje@1.0.0~prebuild:prod: trebovanje@1.0.0 6 info lifecycle trebovanje@1.0.0~build:prod: trebovanje@1.0.0 7 verbose lifecycle trebovanje@1.0.0~build:prod: unsafe-perm in lifecycle true 8 verbose lifecycle trebovanje@1.0.0~build:prod: PATH: C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\nodejs\;C:\Program Files\TortoiseSVN\bin;C:\WINDOWS\System32\OpenSSH\;C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Local\Microsoft\WindowsApps;C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm; 9 verbose lifecycle trebovanje@1.0.0~build:prod: CWD: C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje 10 silly lifecycle trebovanje@1.0.0~build:prod: Args: [ '/d /s /c', 'webpack --config webpack.prod.js' ] 11 silly lifecycle trebovanje@1.0.0~build:prod: Returned: code: 1 signal: null 12 info lifecycle trebovanje@1.0.0~build:prod: Failed to exec build:prod script 13 verbose stack Error: trebovanje@1.0.0 build:prod:webpack --config webpack.prod.js13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16) 13 verbose stack at emitTwo (events.js:106:13) 13 verbose stack at EventEmitter.emit (events.js:191:7) 13 verbose stack at ChildProcess.<anonymous> (C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at emitTwo (events.js:106:13) 13 verbose stack at ChildProcess.emit (events.js:191:7) 13 verbose stack at maybeClose (internal/child_process.js:920:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5) 14 verbose pkgid trebovanje@1.0.0 15 verbose cwd C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje 16 verbose Windows_NT 10.0.17134 17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\bozidar.DESKTOP-F6J3TPV\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:prod" 18 verbose node v6.11.5 19 verbose npm v5.5.1 20 error code ELIFECYCLE 21 error errno 1 22 error trebovanje@1.0.0 build:prod:webpack --config webpack.prod.js22 error Exit status 1 23 error Failed at the trebovanje@1.0.0 build:prod script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

Imaš prav, budem probao metodom eliminacije skužiti tko zeza.

Nisam radio upgrade NodeJS-a …osim ako se on automatski ne napravi prilikom “npm update” naredbe. S time da moram priznaati, nisam previše upućen kakvu ulogu mi igra nodeJS kod webpacka … ovo mi je sve mutno još, nisam ni znao da je nodeJS uključen u webpack.
A niti se ne sjećam da sam radio “npm update” u zadnje vrijeme…

Evo ga:
`
const path = require(“path”);
const webpack = require(“webpack”);
const Merge = require(“webpack-merge”);
const CommonConfig = require("./webpack.common.js");
const ExtractTextPlugin = require(“extract-text-webpack-plugin”);
const UglifyJSPlugin = require(“uglifyjs-webpack-plugin”);

// Images, Fonts Loading: https://webpack.js.org/guides/asset-management/
// LESS Loading: https://webpack.js.org/loaders/less-loader/
// Code splitting: https://webpack.js.org/guides/code-splitting
// Caching: https://webpack.js.org/guides/caching/

const extractLess = new ExtractTextPlugin({
filename: “[name].[contenthash].css”
});

module.exports = Merge(CommonConfig, {
devtool: “hidden-source-map”,

entry: {
    index: path.resolve(__dirname, 'src/index.js'),
    vendor: [
        "jquery",
        "jquery-validation",
        "bootstrap",
        "jquery-validation-unobtrusive"
    ]
},

output: {
    filename: "[name].[chunkhash].js",
    path: __dirname + "/dist",
    // Making sure the CSS and JS files that are split out do not break the template cshtml.
    publicPath: "/dist/",
    // Defining a global var that can used to call functions from within ASP.NET Razor pages.
    library: "aspAndWebpack",
    libraryTarget: "var"
},

module: {
    loaders: [          
        // All css files will be handled here
        {
            test: /\.css$/,
            use: extractLess.extract({ fallback: "style-loader", use: ["css-loader"] })
        },

        // All files with ".less" will be handled and transpiled to css
        {
            test: /\.less$/,
            use: extractLess.extract({
                use: [{
                    loader: "css-loader", options: {
                        sourceMap: true
                    }
                }, {
                    loader: "less-loader", options: {
                        sourceMap: true
                    }
                }]
            })
		},
		// All files with ".scss" will be handled and transpiled to css
		{
			test: /\.scss/,
			use: ["style-loader", "css-loader", "sass-loader"]
		}
    ]
},

plugins: [
    new webpack.DefinePlugin({
        "process.env": {
            "NODE_ENV": JSON.stringify("production")
        }
    }),

    // Split out library into seperate bundle and remove from app bundle.
    new webpack.HashedModuleIdsPlugin(),
    new webpack.optimize.CommonsChunkPlugin({
        name: "vendor"
    }),

    // Webpack boilerplate and manifest in seperate file.
    new webpack.optimize.CommonsChunkPlugin({
        name: "runtime"
    }),

    // Write out CSS bundle to its own file:
    extractLess,

    new webpack.LoaderOptionsPlugin({
        minimize: true,
        debug: false
	}),

	//new UglifyJSPlugin(),

    new webpack.optimize.UglifyJsPlugin({
        beautify: false,
        mangle: {
            screw_ie8: true,
            keep_fnames: true
        },
        compress: {
            screw_ie8: true
        },
        comments: false
    })
]

})

`

P.S. forum malo krivo formatira…ne stavlja sve u code tagove…ali vidi se.

Evo i common file:
(koji je doduše uključen u build:dev naredbi …a ona radi…)

`
const webpack = require(“webpack”);
const CleanWebpackPlugin = require(“clean-webpack-plugin”);
const HtmlWebpackPlugin = require(“html-webpack-plugin”);
var WebpackNotifierPlugin = require(“webpack-notifier”);

module.exports = {
target: “web”,

resolve: {
	// Add ".ts" and ".tsx" as resolvable extensions.
	extensions: [".ts", ".tsx", ".js", ".json", ".html"],
},

module: {
	loaders: [
		// All files with a ".ts" or ".tsx" extension will be handled by "awesome-typescript-loader".
		{ test: /.ts$/, loader: "awesome-typescript-loader" },

		// All image files will be handled here
		{
			test: /\.(png|svg|jpg|gif)$/,
			use: [
				"file-loader"
			]
		},

		// All image files will be handled here ...samo ako je potreban url loader...čini se da file-loader rješava sve
		// {
		// 	test: /\.(png|svg|jpg|gif)$/,
		// 	use: [
		// 		"url-loader"
		// 	]
		// },

		// All font files will be handled here
		{
			test: /\.(woff|woff2|eot|ttf|otf)$/,
			use: [
				{
					loader: "file-loader"
				}
			]
		},

		// All files with ".html" will be handled 
		{ test: /\.html$/, loader: "html-loader" },

		// All output ".js" files will have any sourcemaps re-processed by "source-map-loader".
		{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
	]
},

plugins: ([

	new WebpackNotifierPlugin({alwaysNotify:true}),


	// make sure we allow any jquery usages outside of our webpack modules
	// uz ovo dodaj u top entry point filea: $ = window.$;
	new webpack.ProvidePlugin({
		$: "jquery",
		jQuery: "jquery",
		"window.jQuery": "jquery"
	}),


	// Clean dist folder.
	new CleanWebpackPlugin(["./dist"], {
		"verbose": true // Write logs to console.
	}),

	// avoid publishing when compilation failed.
	new webpack.NoEmitOnErrorsPlugin(),

	new HtmlWebpackPlugin({
		inject: "body",
		filename: "../Views/Shared/_Layout.cshtml",
		template: "./Views/Shared/_Layout_Template.cshtml",
		showErrors:true
	})


]),

// pretty terminal output
stats: { colors: true }

};
`

Nešto je definitivno globalne prirode, jer jedan drugi projekt koji trenutno ne radim…koji se najnormalnije buildao …i sada ga probam buildati i dobijem istu grešku.

Metodom eliminacije sam došao do toga da ako isključim UglifyJsPlugin onda se stvar odradi. Ali…gašenje tog plugina nije rješenje, heh.

Sada pretpostavljam trebam updejtati taj plugin i nadati se, heh…ili?

Potrazi na google webpack chunks Probaj se s tim poigrat.

Ma da…nikako da uhvatim vremena da ozbiljnije proučim webpack. Pa trenutno dosta toga brljavim.
Ovo što si spomenuo je pretpostavljam da mi production fileovi budu razbijeni na logične dijelove koji se koriste…a ne da sve ide u jedan file.
Ako je to to…svjestan sam da taj dio trivijalno(krivo) radim … i to mi je baš na vrhu todo liste što se tiče webpacka… ali sam malo lijen se hvatati s time zasad. Imam kao uglavi da moram webpack pročešljati uzduž i poprijeko, a onda nikako da se uhvatim s tim u koštac. …a trebao bi makar te chunkse odraditi…

Jesi probao sljedece

rm -rf node_modules
npm install

u project direktoriju :smiley: ?

To je nesto sto moras kao scriptu postavit :slight_smile:
"clean":"rm -rf node_modules && npm cache clean --force && rm -rf dist && npm install"

Je l’ može objašnjenje ubogom backend-ašu šta je tačno ovaj directory? Hvala :slightly_smiling_face:

Obicno kompletan bundle projekta.

Znaci cijeli projekat (minificiran, optimizovan ili sta mu vec webpack sve uradi), bude ekstraktovan u taj direktoriji koji kasnije mozes deployat ili sta vec.

ma dist folder je gdje se cesto stavlja output webpacka (bar ga ja tamo stavljam, dist->distribution), tj. direktorij u kojem ti je finalna verzija. Promjeni s obzirom na svoje postavke.

@obojica Hvala.
Mislio sam da je node_modules dovoljan da se nešto link-uje na frontend.
Koristio sam (i dalje koristim) kad zatreba i webpack i node nego mi bilo nejasno za ovo.

Dakle, dist treba ili ne treba biti u .gitignore-u? Tj. zašto ga ne bi kreir’o putem package.json bundle komande ili pješke?

Praksa je da bude u .gitignore.

Ako radis sa Webpackom zadas mu naziv direktorija gdje ce spremiti bundle (u ovom slucaju dist), tako da ne trebas uopste ti brinuti o kreiranju tog direktorija.

:+1:
Trebalo je samo malo dublje (tj. smislenije) zagrebati po materiji.
Tražio sam u npm-u a nalazi se u webpack-u.

webpack znalče :slight_smile: …kako rješavaš tumačenje webpack logova kada pukne stvar prilikom buildanja. Sada sam imao opet situaciju da je dev:build radio bez problema, ali zaglavila neka sitnica koja je trgala kompajliranje prilikom build:prod akcije. A od logova dobijem samo ovo:

Microsoft Windows [Version 10.0.17134.706]
© 2018 Microsoft Corporation. All rights reserved.

C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje>npm run build:prod

trebovanje@1.0.0 build:prod C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje
webpack --config webpack.prod.js

clean-webpack-plugin: C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\dist has been removed.
Hash: 7a64778961f672eed5fa
Version: webpack 3.12.0
Time: 7681ms
11 assets
[3IRH] (webpack)/buildin/module.js 517 bytes {0} [built]
[5TxJ] ./node_config/normJS_hub.js 739 bytes {0} [built]
[5v3A] ./src/style/icomoon/fonts/icomoon.ttf?7h525k 82 bytes [built]
[9zUv] ./node_modules/css-loader!./src/style/icomoon/style.css 2.85 kB [built]
[DUzv] ./src/style/site.scss 1.15 kB {0} [built]
[DuR2] (webpack)/buildin/global.js 509 bytes {0} [built]
[0] multi jquery jquery-validation bootstrap jquery-validation-unobtrusive 64 bytes {1} [built]
[L8QH] ./node_config/bBug_custom_config.js 719 bytes {0} [built]
[Qll0] ./src/style/icomoon/style.css 41 bytes {0} [built]
[TbGY] ./src/style/icomoon/fonts/icomoon.svg?7h525k 82 bytes [built]
[UprH] ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/style/site.scss 18.4 kB {0} [built]
[gGGM] ./src/style/icomoon/fonts/icomoon.woff?7h525k 83 bytes [built]
[lVK7] ./src/index.js 42.6 kB {0} [built]
[mbr7] ./src/style/icomoon/fonts/icomoon.eot?7h525k 82 bytes [built]
+ 58 hidden modules

WARNING in vendor.906d7a1c10dcb3b2a202.js from UglifyJs
Condition always true [vendor.906d7a1c10dcb3b2a202.js:10759,5]
Condition always true [vendor.906d7a1c10dcb3b2a202.js:11483,8]
Dropping unreachable code [vendor.906d7a1c10dcb3b2a202.js:11489,11]
Condition always true [vendor.906d7a1c10dcb3b2a202.js:12145,6]
Dropping unreachable code [vendor.906d7a1c10dcb3b2a202.js:12150,8]

ERROR in index.5c248c30312df71d8ebc.js from UglifyJs
Unexpected token: punc (() [index.5c248c30312df71d8ebc.js:41134,18]

Child html-webpack-plugin for “…\Views\Shared_Layout.cshtml”:
1 asset
[3IRH] (webpack)/buildin/module.js 517 bytes {0} [built]
[DBK8] ./node_modules/html-webpack-plugin/lib/loader.js!./Views/Shared/_Layout_Template.cshtml 1.9 kB {0} [built]
[DuR2] (webpack)/buildin/global.js 509 bytes {0} [built]
+ 1 hidden module
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/@fengyuanchen/datepicker/dist/datepicker.css:
2 modules
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/bozoou_bugger/dist/bBug.css:
2 modules
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/bozoou_default_css/dist/reset.css:
2 modules
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!src/style/icomoon/style.css:
4 assets
[5v3A] ./src/style/icomoon/fonts/icomoon.ttf?7h525k 82 bytes {0} [built]
[9zUv] ./node_modules/css-loader!./src/style/icomoon/style.css 2.85 kB {0} [built]
[TbGY] ./src/style/icomoon/fonts/icomoon.svg?7h525k 82 bytes {0} [built]
[gGGM] ./src/style/icomoon/fonts/icomoon.woff?7h525k 83 bytes {0} [built]
[mbr7] ./src/style/icomoon/fonts/icomoon.eot?7h525k 82 bytes {0} [built]
+ 2 hidden modules
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! trebovanje@1.0.0 build:prod: webpack --config webpack.prod.js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the trebovanje@1.0.0 build:prod 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\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm-cache_logs\2019-04-16T15_09_25_912Z-debug.log

.
.
.
.
Tog file-a u kojem je ukazana greška, kasnije niti nema…jer kako pukne greška prilikom kompilacije niti ne generira nikakve file-ove. A totalni muk o izvornom file-u, ili što bi se očekivalo o liniji izvornog file-a gdje se pojavila greška.

E sad, spomene on nekakav kompletni log da je zapisan…ali taj log je još šturiji čak:

0 info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘run’,
1 verbose cli ‘build:prod’ ]
2 info using npm@5.5.1
3 info using node@v6.11.5
4 verbose run-script [ ‘prebuild:prod’, ‘build:prod’, ‘postbuild:prod’ ]
5 info lifecycle trebovanje@1.0.0~prebuild:prod: trebovanje@1.0.0
6 info lifecycle trebovanje@1.0.0~build:prod: trebovanje@1.0.0
7 verbose lifecycle trebovanje@1.0.0~build:prod: unsafe-perm in lifecycle true
8 verbose lifecycle trebovanje@1.0.0~build:prod: PATH: C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje\node_modules.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\Program Files\nodejs;C:\Program Files\TortoiseSVN\bin;C:\WINDOWS\System32\OpenSSH;C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Local\Microsoft\WindowsApps;C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm;
9 verbose lifecycle trebovanje@1.0.0~build:prod: CWD: C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje
10 silly lifecycle trebovanje@1.0.0~build:prod: Args: [ ‘/d /s /c’, ‘webpack --config webpack.prod.js’ ]
11 silly lifecycle trebovanje@1.0.0~build:prod: Returned: code: 2 signal: null
12 info lifecycle trebovanje@1.0.0~build:prod: Failed to exec build:prod script
13 verbose stack Error: trebovanje@1.0.0 build:prod: webpack --config webpack.prod.js
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess. (C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:920:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid trebovanje@1.0.0
15 verbose cwd C:\Users\bozidar.DESKTOP-F6J3TPV\source\repos\trebovanje\trebovanje
16 verbose Windows_NT 10.0.17134
17 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Users\bozidar.DESKTOP-F6J3TPV\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js” “run” “build:prod”
18 verbose node v6.11.5
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 2
22 error trebovanje@1.0.0 build:prod: webpack --config webpack.prod.js
22 error Exit status 2
23 error Failed at the trebovanje@1.0.0 build:prod script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
.

.
.
Greška je otkrivena na kraju, bila je neka glupa sintatička greška…koja je nekim čudom prolazila build:dev akciju.
A grešku smo tražili binarnim pretraživanjem. Svaki puta cepali cijeli projekt po pola i sužavali usko grlo gdje se može pojaviti. xd xd
Pa, nije baš neki elegantni način traženja greške :smiley: :smiley: …rado bi čuo bolju sugestiju?

To samo govori da ti dev task nije bas najbolje podesen, jer bi dev trebao sva potencijalna sra**a detektuje :slight_smile:

Kao sto rekoh, ako imam neki syntax error obicno mi dev task kaze da ne moze kompajlirati kod zbog toga i toga.

Ako je neki bas edge case, onda citam sta pise u error outputu i googlam taj error ako mi je totalno nepoznat :smiley:

Sto se Webpack-a tice, ne koristim ga vise toliko intenzivno, tj. ne konfigurisem ga :smiley: U vecini slucajeva to je create-react-app i svi sretni :smiley:

Ovdje sam zadnji put podesavao sve od nule (Typescript), jer create-react-app ubaci dosta stvari koje su bespotrebne za neki lib.

1 Like

Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey