npm run build / deploy error on windows - node.js

I am trying to compile files with webpack and npm for my reactJS applciation.
When I run npm start, it all goes well.
When I run npm run deploy or npm run build it does not work under a windows environment. It does work under a linux environment.
Does someone have an idea why ?
My files :
package.json
{
"license": "UNLICENSED",
"private": true,
"version": "1.0.0",
"webPath": "web/",
"nodePath": "node_modules/",
"devDependencies": {
"autoprefixer": "^6.3.1",
"exports-loader": "^0.6.2",
"grunt": "^0.4.5",
"grunt-autoprefixer": "^3.0.3",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-less": "^1.1.0",
"grunt-contrib-uglify": "^0.11.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-css-url-rewrite": "^0.3.5",
"grunt-cssjoin": "^0.3.0",
"grunt-postcss": "^0.7.1",
"imports-loader": "^0.6.5",
"matchdep": "^1.0.0",
"redux-devtools": "^3.0.2",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.4",
"webpack-shell-plugin": "^0.4.2"
},
"repository": {
"type": "git",
"url": ""
},
"dependencies": {
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-plugin-transform-runtime": "^6.4.3",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"babel-runtime": "^6.3.19",
"grunt-postcss": "^0.7.1",
"history": "^1.17.0",
"i18next": "^2.5.1",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.11.1",
"radium": "^0.16.2",
"rc-switch": "^1.4.2",
"react": "^0.14.6",
"react-dom": "^0.14.6",
"react-hot-loader": "^1.3.0",
"react-redux": "^4.1.2",
"react-router": "^1.0.3",
"react-router-redux": "^3.0.0",
"redux": "^3.1.6",
"redux-thunk": "^2.1.0",
"selfupdate": "^1.1.0",
"webpack": "^1.12.11",
"webpack-dev-server": "^1.14.1",
"whatwg-fetch": "^0.11.0"
},
"scripts": {
"start": "node webpack.dev-server.js",
"build": "webpack",
"deploy": "NODE_ENV=production webpack -p --config webpack.production.config.js"
}
}
webpack.config.js
var path = require('path');
var webpack = require('webpack');
var node_modules_dir = path.join(__dirname, 'node_modules');
var devFlagPlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
});
console.log(__dirname);
var config = {
entry: [
'babel-polyfill',
'webpack-dev-server/client?http://127.0.0.1:3000',
'webpack/hot/only-dev-server',
'./app/Resources/react/app.js'
],
output: {
path: path.join(__dirname, 'web/js'),
filename: 'bundle.js',
publicPath: 'http://127.0.0.1:3000/static/'
},
debug: true,
devtool: 'eval',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
devFlagPlugin
],
module: {
loaders: [
{
loaders: ["react-hot","babel-loader?plugins=transform-runtime&presets[]=es2015&presets[]=stage-0&presets[]=react"],
test: /\.js$/,
include: path.join(__dirname, 'app/Resources/react')
}
]
}
};
module.exports = config;
/*
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
})
*/
webpack.dev-server.js
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
quiet: false,
noInfo: false,
contentBase: "./assets"
}).listen(3000, 'localhost', function (err, result) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:3000');
});
webpack.production.config.js
var path = require('path');
var node_modules_dir = path.resolve(__dirname, 'node_modules');
var config = {
entry: [
'babel-polyfill',
'./app/Resources/react/app.js'
],
debug: false,
output: {
path: path.join(__dirname, 'web/js'),
filename: 'bundle.js'
},
module: {
loaders: [
{
loaders: ["babel-loader?plugins=transform-runtime&presets[]=es2015&presets[]=stage-0&presets[]=react"],
test: /\.js$/,
include: path.join(__dirname, 'app/Resources/react')
}
]
},
plugins: []
};
module.exports = config;
I get the following error with npm run build
Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation.
All rights reserved.
D:\Divers\Programmation\Web\foodmeup.dev>npm run build
FoodMeUp#1.0.0 build D:\Divers\Programmation\Web\foodmeup.dev
webpack
D:\Divers\Programmation\Web\foodmeup.dev Hash: 9cb8c898ada89430aa7c
Version: webpack 1.13.1 Time: 3353ms [0] multi main 64 bytes {0}
[built]
+ 739 hidden modules
ERROR in ./app/Resources/react/components/subscription/total.js Module
not found: Error: Cannot resolve module 'lodash' in
D:\Divers\Programmation\Web\foodmeup.dev\app\Resources\react\components\subscription
# ./app/Resources/react/components/subscription/total.js 19:8-25
my total.js file :
import React from 'react';
import { connect } from 'react-redux';
import { updateSubscription } from '../../actions/subscription';
var _ = require('lodash');
...
I get the following error when I launch npm run deploy
D:\Divers\Programmation\Web\foodmeup.dev>npm run deploy
FoodMeUp#1.0.0 deploy D:\Divers\Programmation\Web\foodmeup.dev
NODE_ENV=production webpack -p --config webpack.production.config.js
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.10586 npm ERR! argv
"C:\Development\nodejs\node.exe"
"C:\Development\nodejs\node_modules\npm\bin\npm-cli.js" "run"
"deploy" npm ERR! node v6.2.2 npm ERR! npm v3.9.5 npm ERR! code
ELIFECYCLE npm ERR! FoodMeUp#1.0.0 deploy: NODE_ENV=production
webpack -p --config webpack.production.config.js npm ERR! Exit status
1 npm ERR! npm ERR! Failed at the FoodMeUp#1.0.0 deploy script
'NODE_ENV=production webpack -p --config
webpack.production.config.js'. 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 FoodMeUp package, npm ERR! not with npm
itself. npm ERR! Tell the author that this fails on your system: npm
ERR! NODE_ENV=production webpack -p --config
webpack.production.config.js npm ERR! You can get information on how
to open an issue for this project with: npm ERR! npm bugs FoodMeUp
npm ERR! Or if that isn't available, you can get their info via: npm
ERR! npm owner ls FoodMeUp npm ERR! There is likely additional
logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Divers\Programmation\Web\foodmeup.dev\npm-debug.log
and my npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Development\\nodejs\\node.exe',
1 verbose cli 'C:\\Development\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'deploy' ]
2 info using npm#3.9.5
3 info using node#v6.2.2
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle FoodMeUp#1.0.0~predeploy: FoodMeUp#1.0.0
6 silly lifecycle FoodMeUp#1.0.0~predeploy: no script for predeploy, continuing
7 info lifecycle FoodMeUp#1.0.0~deploy: FoodMeUp#1.0.0
8 verbose lifecycle FoodMeUp#1.0.0~deploy: unsafe-perm in lifecycle true
9 verbose lifecycle FoodMeUp#1.0.0~deploy: PATH: C:\Development\nodejs\node_modules\npm\bin\node-gyp-bin;D:\Divers\Programmation\Web\foodmeup.dev\node_modules\.bin;C:\Development\nodejs;C:\img;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Development\Git\cmd;C:\Program Files (x86)\Windows Live\Shared;C:\Development\wamp\bin\php\php7.0.0;C:\Net Generation\FireFox\;C:\Development\wamp\bin\mysql\mysql5.7.9\bin;C:\Program Files (x86)\Skype\Phone\;D:\Divers\Programmation\Web\foodmeup.dev\node_modules\typescript\bin;C:\Development\nodejs\;C:\Development\ruby\bin;C:\Development\wamp\bin\php\php7.0.0;C:\Development\wamp\bin\mysql\mysql5.7.9\bin;D:\Divers\Programmation\Web\foodmeup.dev\node_modules\typescript\bin;C:\img;C:\Users\Sébastien\AppData\Roaming\npm
10 verbose lifecycle FoodMeUp#1.0.0~deploy: CWD: D:\Divers\Programmation\Web\foodmeup.dev
11 silly lifecycle FoodMeUp#1.0.0~deploy: Args: [ '/d /s /c',
11 silly lifecycle 'NODE_ENV=production webpack -p --config webpack.production.config.js' ]
12 silly lifecycle FoodMeUp#1.0.0~deploy: Returned: code: 1 signal: null
13 info lifecycle FoodMeUp#1.0.0~deploy: Failed to exec deploy script
14 verbose stack Error: FoodMeUp#1.0.0 deploy: `NODE_ENV=production webpack -p --config webpack.production.config.js`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Development\nodejs\node_modules\npm\lib\utils\lifecycle.js:245:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Development\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:852:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid FoodMeUp#1.0.0
16 verbose cwd D:\Divers\Programmation\Web\foodmeup.dev
17 error Windows_NT 10.0.10586
18 error argv "C:\\Development\\nodejs\\node.exe" "C:\\Development\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy"
19 error node v6.2.2
20 error npm v3.9.5
21 error code ELIFECYCLE
22 error FoodMeUp#1.0.0 deploy: `NODE_ENV=production webpack -p --config webpack.production.config.js`
22 error Exit status 1
23 error Failed at the FoodMeUp#1.0.0 deploy script 'NODE_ENV=production webpack -p --config webpack.production.config.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the FoodMeUp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error NODE_ENV=production webpack -p --config webpack.production.config.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs FoodMeUp
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls FoodMeUp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

It looks like the configuration file is not 100% correct. See details below:
need to import 'webpack' mobile before using it (webpack.config.js),
i.e., const webpack = require('webpack');
need to import path module before using it (webpack.config.js),
i.e., const path = require('path');
devFlagPlugin is not defined
also exclude the node_modules directory in the loader
module: {
loaders: [
{
....
exclude: path.resolve(__dirname, 'node_modules/')
}
]
}

I think you have two different problems.
Lodash is missing?
Now, I'm not an expert in Webpack so somebody may point out something obvious that I don't see...but...when you say it doesn't work under Windows, have you tried it on multiple Windows systems?
If this issue is only on one system or it's a PITA to get onto a second box or whatever, try:
Delete the node_modules directory
Execute npm cache clean to be sure you'll start fresh when you reinstall
Re-install with npm i --verbose > npm-install-log.txt
If the install still doesn't work, you'll have an install log to review to see if something is failing to compile or there's some other wacky error that may not be visible after install.
NODE_ENV on Windows
The NODE_ENV=production <commands> syntax is a *nix thing but not a Windows/DOS thing.
In this case, you may find it easier to create a .bat file for this where you set the variable on the first line and call the command on the second. However, this won't work on *nix platforms so....maybe:
Create two scripts and two entries in package.json, one for each OS. If it's a simple project that's mostly maintained by hand, that's probably cool.
Create a deploy.js script, executed by node, that sets the NODE_ENV variable, calls webpack via the node api to do the work. This should be OS independent and is a single script...

You can set environment variables in a cross-platform manner by using cross-env:
"deploy": "cross-env NODE_ENV=production webpack -p --config webpack.production.config.js"

Related

how to run test inside a nextjs project

I need to use react-testing-library for unit test cases in nextjs application. In react applications which was created using create react app, I used to just call npm run test and the test scripts run.
But in nexJs while trying to calling npm run test if gives errors.
The nextjs application was created using create-next-app.
I installed react-testing-library manually into nextjs application.
I installed:
#testing-library/react
#testing-library/jest-dom
#testing-library/user-event
jest
babel-jest
And in package.js added the test script:
"test": "jest"
package.json:
{
"name": "thestobook",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest"
},
"dependencies": {
"#emotion/react": "^11.7.1",
"#emotion/styled": "^11.6.0",
"#material-ui/core": "^4.12.3",
"#material-ui/icons": "^4.11.2",
"#mui/icons-material": "^5.3.1",
"#mui/material": "^5.4.0",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.2.0",
"#testing-library/user-event": "^14.2.0",
"#types/axios": "^0.14.0",
"axios": "^0.25.0",
"babel-jest": "^28.1.0",
"bcryptjs": "^2.4.3",
"formik": "^2.2.9",
"jest": "^28.1.0",
"js-cookie": "^3.0.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.2.0",
"next": "12.0.10",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-outside-click-handler": "^1.3.0",
"react-slugify": "^2.1.0",
"react-test-renderer": "^18.1.0",
"react-toastify": "^8.2.0",
"recoil": "^0.6.1",
"sass": "^1.49.4",
"slugify": "^1.6.5",
"use-image-color": "0.0.9",
"yup": "^0.32.11"
},
"devDependencies": {
"#types/node": "17.0.14",
"#types/react": "17.0.38",
"eslint": "8.8.0",
"eslint-config-next": "12.0.10",
"typescript": "4.5.5"
}
}
After installation, Created jest.config.js:
module.exports = {
setupFilesAfterEnv: ["./jest.setup.js"],
};
also created jest.setup.js:
import "#testing-library/jest-dom";
test file created in __ test __ folder --> ComponentName.test.js
import { render, screen } from "#testing-library/react";
import Profile from "../Profile";
it("should be same as the text passed", () => {
render(<Profile />);
const textElement = screen.getByText(/explore/i);
expect(textElement).toBeInTheDocument();
});
While npm run test, It runs the test but after that gives error.
Error in terminal:
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.343 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! thestobook# test: `jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the thestobook# test 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/saikrishnadas/.npm/_logs/2022-05-25T09_49_40_372Z-debug.log
Complete Error Log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test' ]
2 info using npm#6.14.13
3 info using node#v14.17.1
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle thestobook#~pretest: thestobook#
6 info lifecycle thestobook#~test: thestobook#
7 verbose lifecycle thestobook#~test: unsafe-perm in lifecycle true
8 verbose lifecycle thestobook#~test: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/saikrishnadas/thestobook/thestobook/node_modules/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/opt/homebrew/sbin
9 verbose lifecycle thestobook#~test: CWD: /Users/saikrishnadas/sai-learn/thestobook/thestobook
10 silly lifecycle thestobook#~test: Args: [ '-c', 'jest' ]
11 silly lifecycle thestobook#~test: Returned: code: 1 signal: null
12 info lifecycle thestobook#~test: Failed to exec test script
13 verbose stack Error: thestobook# test: `jest`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:375:28)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:375:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid thestobook#
15 verbose cwd /Users/saikrishnadas/thestobook/thestobook
16 verbose Darwin 21.1.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
18 verbose node v14.17.1
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 1
22 error thestobook# test: `jest`
22 error Exit status 1
23 error Failed at the thestobook# test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

What are the ways to resolve npm run dev error?

I deployed my Laravel version 7 project on Hostinger. I managed to set up my project and installed node using nvm but when I run npm run dev, it just won't execute.
I tried to execute:
npm cache clean --force
rm -rf node_modules package-lock.json
npm install
and npm rebuild
but nothing changes and the error is still there.
Here is my error log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/u618667693/.nvm/versions/node/v14.17.0/bin/node',
1 verbose cli '/home/u618667693/.nvm/versions/node/v14.17.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'prod'
1 verbose cli ]
2 info using npm#6.14.13
3 info using node#v14.17.0
4 verbose run-script [ 'preprod', 'prod', 'postprod' ]
5 info lifecycle #~preprod: #
6 info lifecycle #~prod: #
7 verbose lifecycle #~prod: unsafe-perm in lifecycle true
8 verbose lifecycle #~prod: PATH: /home/u618667693/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/u618667693/domains/expensetracker.site/expense-tracker/node_modules/.bin:/home/u618667693/.nvm/versions/node/v14.17.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
9 verbose lifecycle #~prod: CWD: /home/u618667693/domains/expensetracker.site/expense-tracker
10 silly lifecycle #~prod: Args: [ '-c', 'npm run production' ]
11 silly lifecycle #~prod: Returned: code: 1 signal: null
12 info lifecycle #~prod: Failed to exec prod script
13 verbose stack Error: # prod: `npm run production`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/u618667693/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:376:20)
13 verbose stack at ChildProcess.<anonymous> (/home/u618667693/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:376:20)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid #
15 verbose cwd /home/u618667693/domains/expensetracker.site/expense-tracker
16 verbose Linux 4.18.0-147.8.1.el7h.lve.1.x86_64
17 verbose argv "/home/u618667693/.nvm/versions/node/v14.17.0/bin/node" "/home/u618667693/.nvm/versions/node/v14.17.0/bin/npm" "run" "prod"
18 verbose node v14.17.0
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 1
22 error # prod: `npm run production`
22 error Exit status 1
23 error Failed at the # prod script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
This is my package.json file:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.21.1",
"bootstrap": "^4.0.0",
"cross-env": "^7.0.3",
"deepmerge": "^4.2.2",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.32.13",
"sass-loader": "^8.0.2",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
},
"dependencies": {
"#mdi/font": "^5.9.55",
"chart.js": "^2.9.4",
"chartjs-plugin-datalabels": "^1.0.0",
"moment": "^2.29.1",
"numeral": "^2.0.6",
"pdfmake": "^0.1.71",
"randomcolor": "^0.6.2",
"vue-chartjs": "^3.5.1",
"vue-router": "^3.5.1",
"vuetify": "^2.5.0",
"vuetify-confirm": "^2.0.6",
"vuetify-dialog": "^2.0.14",
"vuex": "^3.6.2",
"vuex-persistedstate": "^4.0.0-beta.3"
}
}
Thank you in advance.

Updated Create-React-App no longer builds

Something interesting happened. I added some libraries (material ui) which forced me to update my 16.3 version of react to hooks (16.8) but unfortunately due a package not supporting react-scripts 2.x I had to stick with react-scripts: 1.1.0 and everything was still running fine with npm run start but now when I try to build with npm run build I get a UglifyJS error: maxium call stack size exceeded.
I tried removing/reinstalling node_modules and it didn't help.
I searched all the other topics and unfortunately none of them seemed to match my situation as I have not touched Babel, webpack, or ejected.
Note: I have NOT ejected the Create-React-App.
TERMINAL ERROR MESSAGE:
Creating an optimized production build...
Failed to compile.
Failed to minify the bundle. Error: static/js/main.5a18352c.js from UglifyJs
RangeError: Maximum call stack size exceeded
at compiler.run (/Users/mike/Documents/Websites/mySite/viewer/node_modules/react-scripts/scripts/build.js:128:23)
at emitRecords.err (/Users/mike/Documents/Websites/mySite/viewer/node_modules/webpack/lib/Compiler.js:269:13)
at Compiler.emitRecords (/Users/mike/Documents/Websites/mySite/viewer/node_modules/webpack/lib/Compiler.js:375:38)
at emitAssets.err (/Users/mike/Documents/Websites/mySite/viewer/node_modules/webpack/lib/Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (/Users/mike/Documents/Websites/mySite/viewer/node_modules/webpack/lib/Compiler.js:368:12)
at next (/Users/mike/Documents/Websites/mySite/viewer/node_modules/tapable/lib/Tapable.js:218:11)
at Compiler.compiler.plugin (/Users/mike/Documents/Websites/mySite/viewer/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at next (/Users/mike/Documents/Websites/mySite/viewer/node_modules/tapable/lib/Tapable.js:220:14)
at /Users/mike/Documents/Websites/mySite/viewer/node_modules/sw-precache-webpack-plugin/lib/index.js:98:18
Here is error log from the npm run build (I changed some sensitive info)
debug.log (npm run build):
0 info it worked if it ends with ok
1 verbose cli [ '/Users/mike/.nvm/versions/node/v10.18.0/bin/node',
1 verbose cli '/Users/mike/.nvm/versions/node/v10.18.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#6.13.4
3 info using node#v10.18.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle mySite-Web-Application#1.2.10-w~prebuild: mySite-Web-Application#1.2.10-w
6 info lifecycle mySite-Web-Application#1.2.10-w~build: mySite-Web-Application#1.2.10-w
7 verbose lifecycle mySite-Web-Application#1.2.10-w~build: unsafe-perm in lifecycle true
8 verbose lifecycle mySite-Web-Application#1.2.10-w~build: PATH: /Users/mike/.nvm/versions/node/v10.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/mike/Documents/Websites/mySite/viewer/node_modules/.bin:/Users/mike/.nvm/versions/node/v10.18.0/bin:/Users/mike/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mike/.nvm/versions/node/v10.18.0/bin:/Users/mike/google-cloud-sdk/bin
9 verbose lifecycle mySite-Web-Application#1.2.10-w~build: CWD: /Users/mike/Documents/Websites/mySite/viewer
10 silly lifecycle mySite-Web-Application#1.2.10-w~build: Args: [ '-c', 'react-scripts build && rm build/static/js/*.map' ]
11 silly lifecycle mySite-Web-Application#1.2.10-w~build: Returned: code: 1 signal: null
12 info lifecycle mySite-Web-Application#1.2.10-w~build: Failed to exec build script
13 verbose stack Error: mySite-Web-Application#1.2.10-w build: `react-scripts build && rm build/static/js/*.map`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/mike/.nvm/versions/node/v10.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/Users/mike/.nvm/versions/node/v10.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid mySite-Web-Application#1.2.10-w
15 verbose cwd /Users/mike/Documents/Websites/mySite/viewer
16 verbose Darwin 18.2.0
17 verbose argv "/Users/mike/.nvm/versions/node/v10.18.0/bin/node" "/Users/mike/.nvm/versions/node/v10.18.0/bin/npm" "run" "build"
18 verbose node v10.18.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error mySite-Web-Application#1.2.10-w build: `react-scripts build && rm build/static/js/*.map`
22 error Exit status 1
23 error Failed at the mySite-Web-Application#1.2.10-w build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Package.json:
{
"name": "Mysite-Web-Application",
"version": "1.2.10w",
"private": true,
"homepage": "http://www.mysite.ca/app/",
"dependencies": {
"#material-ui/core": "^4.5.1",
"#material-ui/icons": "^4.5.1",
"#sentry/browser": "^5.7.1",
"bootstrap": "^4.3.1",
"date-fns": "^1.30.1",
"default-passive-events": "^1.0.10",
"dompurify": "^1.0.11",
"exif-js": "^2.3.0",
"firebase": "^7.2.2",
"firebase-auto-ids": "^1.1.0",
"hammer-touchemulator": "0.0.2",
"hammerjs": "^2.0.8",
"install": "^0.11.2",
"konva": "^4.0.16",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"normalize.css": "^8.0.1",
"npm": "^6.12.0",
"pdfjs-dist": "^2.2.228",
"prop-types": "^15.7.2",
"react": "^16.8.0",
"react-app-polyfill": "^1.0.4",
"react-beautiful-dnd": "^9.0.2",
"react-collapse": "^5.0.0",
"react-datepicker": "^2.9.6",
"react-dom": "^16.8.0",
"react-image-gallery": "^0.8.18",
"react-konva": "^16.10.1-0",
"react-pdf": "^2.5.3",
"react-responsive-modal": "^3.6.0",
"react-router-dom": "^4.3.1",
"react-router-hash-link": "^1.2.2",
"react-scripts": "1.1.0",
"tesseract.js": "^1.0.19"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && rm build/static/js/*.map",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": {
"production": [
">0.2%",
"not op_mini all"
],
"development": [
"last 2 chrome version",
"last 2 firefox version",
"last 2 safari version"
]
},
"devDependencies": {
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint-plugin-react-hooks": "^2.2.0"
}
}
Try to run rm -rf node_modules in the root folder and npm install after
I had the same problem, and was a icon i had added in a component, with #material-ui/icons. When i removed it, i could build again, but i don't found the solution too.
I had some issues with my build as well. Whist checking around in the community for solutions, I came across this repository:
A Frontend build config generator
TLTR; Basically its a boilerplate that can get up and going quickly!
SO% to the developer being the c - https://github.com/jakoblind.

Receiving an npm error after running "npm run build" : npm ERR! code ELIFECYCLE npm ERR! errno 2

I am having difficulty getting to the bottom of this npm error I am receiving after my npm run build script executes. The error in the terminal is as follows:
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! vincent-site#1.0.0 build: `webpack --mode production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the vincent-site#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! /Users/vincentcastelli/.npm/_logs/2018-11-10T20_27_41_388Z-debug.
Not very descriptive. I am using the most recent npm version at the time of writing this (6.4.1) and the most recent node (11.1.0). I am also using Babel 7 with Webpack 4 for my compiling. I have tried a few things so far.
I have tried the following steps when using both the recent version of npm/node and older versions:
npm cache clean --force
delete node_modules by $ rm -rf node_modules folder
npm install
Still receiving the error.
My log output:
0 info it worked if it ends with ok
1 verbose cli [ '/Users/vincentcastelli/.nvm/versions/node/v11.1.0/bin/node',
1 verbose cli '/Users/vincentcastelli/.nvm/versions/node/v11.1.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#6.4.1
3 info using node#v11.1.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle vincent-site#1.0.0~prebuild: vincent-site#1.0.0
6 info lifecycle vincent-site#1.0.0~build: vincent-site#1.0.0
7 verbose lifecycle vincent-site#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle vincent-site#1.0.0~build: PATH: /Users/vincentcastelli/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/vincentcastelli/Documents/02_Projects/vincent-site/node_modules/.bin:/Users/vincentcastelli/.nvm/versions/node/v11.1.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle vincent-site#1.0.0~build: CWD: /Users/vincentcastelli/Documents/02_Projects/vincent-site
10 silly lifecycle vincent-site#1.0.0~build: Args: [ '-c', 'webpack --mode production' ]
11 silly lifecycle vincent-site#1.0.0~build: Returned: code: 2 signal: null
12 info lifecycle vincent-site#1.0.0~build: Failed to exec build script
13 verbose stack Error: vincent-site#1.0.0 build: `webpack --mode production`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (/Users/vincentcastelli/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/Users/vincentcastelli/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
14 verbose pkgid vincent-site#1.0.0
15 verbose cwd /Users/vincentcastelli/Documents/02_Projects/vincent-site
16 verbose Darwin 18.0.0
17 verbose argv "/Users/vincentcastelli/.nvm/versions/node/v11.1.0/bin/node" "/Users/vincentcastelli/.nvm/versions/node/v11.1.0/bin/npm" "run" "build"
18 verbose node v11.1.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error vincent-site#1.0.0 build: `webpack --mode production`
22 error Exit status 2
23 error Failed at the vincent-site#1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
My package.json:
}
"scripts": {
"start": "node server.js",
"build": "webpack --mode production"
},
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3",
"prop-types": "^15.6.1",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-router-dom": "^4.3.1"
},
"engines": {
"node": "10.13.0"
},
"babel": {
"presets": [
"#babel/preset-env",
"#babel/react"
],
"plugins": [
"#babel/proposal-class-properties"
]
},
"eslintConfig": {
"extends": "airbnb",
"parser": "babel-eslint"
},
"devDependencies": {
"#babel/core": "^7.1.5",
"#babel/plugin-proposal-class-properties": "^7.1.0",
"#babel/plugin-proposal-object-rest-spread": "^7.0.0",
"#babel/preset-env": "^7.1.5",
"#babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"css-loader": "^1.0.1",
"eslint": "^5.9.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-ejs": "0.0.2",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
"file-loader": "^2.0.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.10.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2"
}
}
My webpack config:
const path = require('path');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const distDir = path.join(__dirname, '/dist');
const srcDir = path.join(__dirname, '/src');
module.exports = {
entry: `${srcDir}/index.jsx`,
output: {
path: `${distDir}`,
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: ['babel-loader', 'eslint-loader'],
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
},
{
test: /\.scss$/,
use: [
"style-loader",
"css-loader",
"sass-loader"
]
},
{
test: /\.(jpg|mp4|ogv|webm)$/,
use: 'file-loader',
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: "./dist/index.html",
filename: "./index.html"
})
],
resolve: { extensions: ['*', '.js', '.jsx'] },
devtool: 'cheap-eval-source-map',
};
I feel that the issue stems from a package versioning incompatibility but isolating the issue has been challenging. Thank you in advance for the assistance!
Step 1: $ npm cache clean --force
Step 2: delete node_modules folder
step 3: delete package-lock.json file
Step 4: npm install
To start again, $ npm run start or npm run build
This worked for me. Hopes it works for you.
I found out my CI/CD pipeline on Semaphore was running on a virtual machine without enough memory, thus it was failing and throwing me the error 😭
Check your memory wherever you are running that command

Angular 2 Final Release Protractor Issue using Webpack

Today I was updating an Angular RC 6 application to the newly released final release version. Everything's working fine, however I'm having an issue with Protractor. I'm getting the following error:
server.listen(port, opt_host, function() {
TypeError: Cannot read property 'listen' of undefined
All I've changed from the previous version of the application is the package.json file. I'm guessing that this is a configuration issue but I can't seem to find anything that's changed with regards to the Protractor config.
Also I'm using webpack in this application - I don't know if it's an issue related to webpack. Maybe someone's had some issues with webpack and Angular 2 Final release version.
protractor.conf.js
'use strict';
require('ts-node/register');
require('core-js/es6');
require('reflect-metadata');
require("zone.js/dist/zone-node");
var helpers = require('./helpers');
exports.config = {
baseUrl: 'http://localhost:8080/yii/application/test_backend_mvc/branches/INT-81_RD/ng-app/dist/',
// use `npm run e2e`
specs: [
helpers.root('src/**/**.e2e.ts'),
helpers.root('src/**/*.e2e.ts')
],
exclude: [],
framework: 'jasmine2',
allScriptsTimeout: 110000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['show-fps-counter=true']
}
},
onPrepare: function() {
browser.ignoreSynchronization = true;
},
/**
* Angular 2 configuration
*
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
* `rootEl`
*/
useAllAngular2AppRoots: true
};
npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'protractor' ]
2 info using npm#3.10.3
3 info using node#v6.5.0
4 verbose run-script [ 'preprotractor', 'protractor', 'postprotractor' ]
5 info lifecycle test-ui-prototype#1.0.0~preprotractor: test-ui-prototype#1.0.0
6 silly lifecycle test-ui-prototype#1.0.0~preprotractor: no script for preprotractor, continuing
7 info lifecycle test-ui-prototype#1.0.0~protractor: test-ui-prototype#1.0.0
8 verbose lifecycle test-ui-prototype#1.0.0~protractor: unsafe-perm in lifecycle true
9 verbose lifecycle test-ui-prototype#1.0.0~protractor: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\.bin;C:\Program Files\nodejs;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\daniel.grima\AppData\Roaming\npm
10 verbose lifecycle test-ui-prototype#1.0.0~protractor: CWD: c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app
11 silly lifecycle test-ui-prototype#1.0.0~protractor: Args: [ '/d /s /c', 'protractor' ]
12 silly lifecycle test-ui-prototype#1.0.0~protractor: Returned: code: 1 signal: null
13 info lifecycle test-ui-prototype#1.0.0~protractor: Failed to exec protractor script
14 verbose stack Error: test-ui-prototype#1.0.0 protractor: `protractor`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid test-ui-prototype#1.0.0
16 verbose cwd c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app
17 error Windows_NT 10.0.10586
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
19 error node v6.5.0
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error test-ui-prototype#1.0.0 protractor: `protractor`
22 error Exit status 1
23 error Failed at the test-ui-prototype#1.0.0 protractor script 'protractor'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the test-ui-prototype package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error protractor
23 error You can get information on how to open an issue for this project with:
23 error npm bugs test-ui-prototype
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls test-ui-prototype
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
package.json
{
"name": "test-ui-prototype",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --inline --progress --profile --bail --port 8581",
"lite": "lite-server",
"build:dev": "rimraf dist && webpack --config config/webpack.dev.js --progress --profile --bail",
"build:prod": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"test": "gulp test",
"watch": "gulp tdd",
"test:karma": "karma start",
"watch:karma": "npm run test:karma -- --auto-watch --no-single-run",
"e2e": "npm run protractor",
"e2e:live": "npm run e2e -- --elementExplorer",
"lint": "gulp tslint",
"tslint": "tslint -c tslint.json src/**/*.ts",
"protractor": "protractor",
"pree2e": "npm run webdriver:update -- --standalone",
"ci": "npm run lint && npm test && npm run e2e",
"webdriver-manager": "webdriver-manager",
"webdriver:update": "npm run webdriver-manager update",
"webdriver:start": "npm run webdriver-manager start"
},
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/router": "3.0.0",
"#angular/upgrade": "2.0.0",
"angular2-in-memory-web-api": "0.0.20",
"angular2-jwt": "^0.1.16",
"es6-shim": "^0.35.0",
"jquery": "^2.2.4",
"ng2-cookies": "^0.1.9",
"ts-node": "^0.9.3",
"primeng": "1.0.0-beta.15",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"core-js": "^2.4.0",
"zone.js": "^0.6.17"
},
"devDependencies": {
"ts-promise": "^0.3.0",
"codelyzer": "0.0.22",
"concurrently": "^2.0.0",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"gulp": "^3.9.1",
"gulp-tslint": "^5.0.0",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.22.0",
"jasmine-core": "^2.4.1",
"karma": "^1.1.0",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-html-reporter": "^0.2.7",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"lite-server": "^2.2.0",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^3.2.2",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.2",
"style-loader": "^0.13.1",
"ts-loader": "^0.8.1",
"tslint": "^3.10.2",
"tslint-loader": "^2.1.4",
"typescript": "^1.8.10",
"typings": "^1.3.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"webpack-merge": "^0.14.0"
}
}
Update - Further testing
For testing purposes I've created a new project using angular-cli with Webpack. I've done this to verify whether there's anything amiss with the configurations in my application. I didn't notice anything extraordinarily different. The only thing I've tried is updating protractor to the latest version 4.0.5. Unfortunately I'm getting the same result: Cannot read property 'listen' of undefined
> test-ui-prototype#1.0.0 protractor c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app
> protractor
[16:41:24] I/direct - Using ChromeDriver directly...
[16:41:24] I/launcher - Running 1 instances of WebDriver
[16:41:24] E/launcher - Cannot read property 'listen' of undefined
[16:41:24] E/launcher - TypeError: Cannot read property 'listen' of undefined
at isFree (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\net\portprober.js:171:9)
at findPort (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\net\portprober.js:203:7)
at c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\net\portprober.js:192:5
at ManagedPromise.invokeCallback_ (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:2775:27)
at c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:639:7
at ZoneDelegate.invoke (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\zone.js\dist\zone-node.js:203:28)
at Zone.run (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\zone.js\dist\zone-node.js:96:43)
[16:41:24] E/launcher - Process exited with error code 199

Resources