Error occured when executing command: npm run serve - node.js

I have tried all the options changes my version typescript from "2.4.2" to "2.4.1"
Also I have separately executed "npm run serve"and "npm run build:watch" but it does not works. I have set the environment vairable but is does not work at all.
please help to resolve this.
while running cmd npm start following errors comes:
Error occured when executing command: npm run serve
Error: spawn cmd.exe ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
Error occured when executing command:
npm run serve
Error: spawn cmd.exe ENOENT
at exports._errnoException (util.js:1018:11)`enter code here`
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
[1] npm run serve exited with code -4058
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-quickstart#1.0.0 start: `concurrently "npm run build:watch"
"npm run serve"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 start 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\Nitesh Sharma\AppData\Roaming\npm-cache\_logs\2017-08-04T05_49_43_912Z-debug.log
Here is my package.json file:
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented
with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"#angular/common": "~4.0.0",
"#angular/compiler": "~4.0.0",
"#angular/core": "~4.0.0",
"#angular/forms": "~4.0.0",
"#angular/http": "~4.0.0",
"#angular/platform-browser": "~4.0.0",
"#angular/platform-browser-dynamic": "~4.0.0",
"#angular/router": "~4.0.0",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#types/jasmine": "2.5.36",
"#types/node": "^6.0.46",
"canonical-path": "0.0.2",
"concurrently": "^3.2.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"tslint": "^3.15.1",
"typescript": "^2.4.2"
},
"repository": {}
}
My debug log is :
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 'start' ]
2 info using npm#3.10.10
3 info using node#v6.11.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart#1.0.0~prestart: angular-quickstart#1.0.0
6 verbose lifecycle angular-quickstart#1.0.0~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle angular-quickstart#1.0.0~prestart: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master\node_modules\.bin;C:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Nitesh Sharma\AppData\Roaming\npm
8 verbose lifecycle angular-quickstart#1.0.0~prestart: CWD: C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master
9 silly lifecycle angular-quickstart#1.0.0~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle angular-quickstart#1.0.0~prestart: Returned: code: 0 signal: null
11 info lifecycle angular-quickstart#1.0.0~start: angular-quickstart#1.0.0
12 verbose lifecycle angular-quickstart#1.0.0~start: unsafe-perm in lifecycle true
13 verbose lifecycle angular-quickstart#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master\node_modules\.bin;C:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Nitesh Sharma\AppData\Roaming\npm
14 verbose lifecycle angular-quickstart#1.0.0~start: CWD: C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master
15 silly lifecycle angular-quickstart#1.0.0~start: Args: [ '/d /s /c',
15 silly lifecycle 'concurrently "npm run build:watch" "npm run serve"' ]
16 silly lifecycle angular-quickstart#1.0.0~start: Returned: code: 1 signal: null
17 info lifecycle angular-quickstart#1.0.0~start: Failed to exec start script
18 verbose stack Error: angular-quickstart#1.0.0 start: `concurrently "npm run build:watch" "npm run serve"`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at EventEmitter.emit (events.js:191:7)
18 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at ChildProcess.emit (events.js:191:7)
18 verbose stack at maybeClose (internal/child_process.js:891:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
19 verbose pkgid angular-quickstart#1.0.0
20 verbose cwd C:\Users\Nitesh Sharma\Downloads\Desktop\Angular_2\shared_code\quickstart-master
21 error Windows_NT 6.1.7601
22 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
23 error node v6.11.1
24 error npm v3.10.10
25 error code ELIFECYCLE
26 error angular-quickstart#1.0.0 start: `concurrently "npm run build:watch" "npm run serve"`
26 error Exit status 1
27 error Failed at the angular-quickstart#1.0.0 start script 'concurrently "npm run build:watch" "npm run serve"'.
27 error Make sure you have the latest version of node.js and npm installed.
27 error If you do, this is most likely a problem with the angular-quickstart package,
27 error not with npm itself.
27 error Tell the author that this fails on your system:
27 error concurrently "npm run build:watch" "npm run serve"
27 error You can get information on how to open an issue for this project with:
27 error npm bugs angular-quickstart
27 error Or if that isn't available, you can get their info via:
27 error npm owner ls angular-quickstart
27 error There is likely additional logging output above.
28 verbose exit [ 1, true ]

Had the same issue, adding the "cmd.exe" to the path fixed the problem, if you are on windows just add/append to "Enviroment Variables > Path" this line:
C:\Windows\System32
Hope it helps somebody!

To solve "spawn cmd.exe ENOENT". Go to settings and click on the advance system settings, then click Environment Variables. Click on the Path under system variables and click edit and click new on the displayed menu. After that add this line:
C:\Windows\System32

Related

npm installation eroor on fresh laravel 8 app

I am using laragon. Created a fresh laravel 8 app. Installed Jetstream and livewire. Then tried running npm install && npm run dev. but getting error.
I have tried Delete node_modules folder and package-lock.json
reinstall package using npm install
Cleared npm cache
Tried run npm run dev again but didn't help.
my package.json
{
"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",
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
},
"devDependencies": {
"#tailwindcss/forms": "^0.4.0",
"#tailwindcss/typography": "^0.5.0",
"alpinejs": "^3.0.6",
"axios": "^0.19",
"cross-env": "^7.0",
"laravel-mix": "^6.0.43",
"lodash": "^4.17.19",
"postcss-import": "^14.0.1",
"resolve-url-loader": "^3.1.0",
"tailwindcss": "^3.0.0",
"vue-template-compiler": "^2.6.14"
}
}
My log file:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\laragon\\bin\\nodejs\\node-v14\\node.exe',
1 verbose cli 'C:\\laragon\\bin\\nodejs\\node-v14\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.14.12
3 info using node#v14.16.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 info lifecycle #~dev: #
7 verbose lifecycle #~dev: unsafe-perm in lifecycle true
8 verbose lifecycle #~dev: PATH: C:\laragon\bin\nodejs\node-v14\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\laragon\www\school\node_modules\.bin;C:\Users\This pc\AppData\Local\Yarn\config\global\node_modules\.bin;C:\Users\This pc\AppData\Roaming\npm;C:\Users\This pc\AppData\Roaming\Composer\vendor\bin;;C:\laragon\bin\laragon\utils;C:\laragon\bin\mysql\mysql-5.7.33-winx64\bin;C:\laragon\bin\php\php-7.4.19-Win32-vc15-x64;C:\laragon\bin\composer;C:\laragon\bin\apache\httpd-2.4.47-win64-VS16\bin;C:\laragon\bin\redis\redis-x64-3.2.100;C:\laragon\bin\nodejs\node-v14;C:\laragon\bin\nginx\nginx-1.19.10;C:\laragon\bin\notepad++;C:\laragon\bin\telnet;C:\laragon\bin\ngrok;C:\laragon\bin\git\bin;C:\laragon\bin\git\cmd;C:\laragon\bin\git\usr\bin;C:\laragon\bin\git\mingw64\bin;C:\laragon\bin;C:\laragon\usr\bin;C:\laragon\bin\cmder\bin;C:\Python310\Scripts\;C:\Python310\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Users\This pc\AppData\Local\Microsoft\WindowsApps;C:\Users\This pc\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\This pc\AppData\Local\GitHubDesktop\bin;C:\laragon\bin\php\php-7.4.19-Win32-vc15-x64;C:\laragon\bin\php\php-8.1.3-nts-Win32-vs16-x64;C:\Users\This pc\AppData\Roaming\npm;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\share\vim\vim74;C:\laragon\bin\cmder\;
9 verbose lifecycle #~dev: CWD: C:\laragon\www\school
10 silly lifecycle #~dev: Args: [ '/d /s /c', 'npm run development' ]
11 silly lifecycle #~dev: Returned: code: 1 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\laragon\bin\nodejs\node-v14\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\laragon\bin\nodejs\node-v14\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid #
15 verbose cwd C:\laragon\www\school
16 verbose Windows_NT 10.0.19044
17 verbose argv "C:\\laragon\\bin\\nodejs\\node-v14\\node.exe" "C:\\laragon\\bin\\nodejs\\node-v14\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v14.16.1
19 verbose npm v6.14.12
20 error code ELIFECYCLE
21 error errno 1
22 error # dev: `npm run development`
22 error Exit status 1
23 error Failed at the # dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Use the new Mix CLI. Inside scripts use...
"scripts": {
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"production": "mix --production"
}

create-react-app build process take too long

We received from a partner a front end to interact with our API (builed in node.js) builded using create-create-app, after cloning the repo from our partner git,
the npm start command works, I can locally test the app interacting with the API with no problems at all.
also in my local machine the npm run build command works great, im able to build and run the app with serve build command.
the problem comes after cloning the repo into the Amazon AWS EC2 instance, im able to clone the repo but after running npm install, when running npm run build the process just stay forever in the following message:
sudo npm run build
> sensores#0.1.0 build /var/www/smartdots-frontend
> react-scripts build
Creating an optimized production build...
after 20 minutes or so the process keep hanged and lastly this is the final message:
> sensores#0.1.0 build /var/www/smartdots-frontend
> react-scripts build
Creating an optimized production build...
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sensores#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sensores#0.1.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! /home/ubuntu/.npm/_logs/2019-01-12T21_26_31_254Z-debug.log
Finally, this is the log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm#6.5.0
3 info using node#v11.6.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle sensores#0.1.0~prebuild: sensores#0.1.0
6 info lifecycle sensores#0.1.0~build: sensores#0.1.0
7 verbose lifecycle sensores#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle sensores#0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/smartdots-frontend/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
9 verbose lifecycle sensores#0.1.0~build: CWD: /var/www/smartdots-frontend
10 silly lifecycle sensores#0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle sensores#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle sensores#0.1.0~build: Failed to exec build script
13 verbose stack Error: sensores#0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:188:13)
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:188:13)
13 verbose stack at maybeClose (internal/child_process.js:978:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid sensores#0.1.0
15 verbose cwd /var/www/smartdots-frontend
16 verbose Linux 4.4.0-1069-aws
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v11.6.0
19 verbose npm v6.5.0
20 error code ELIFECYCLE
21 error errno 1
22 error sensores#0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the sensores#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I've tested the npm run build in several machines, with different OS, and it always run fine, in really desperated about this, i've tried building the app as root, changing folder permissions and ownership, and nothing works, building the app in another computer and serve it in the AWS machine also doesn't work
node --version
v11.6.0
npm --version
6.5.0
create-react-app --version
2.1.3
package.json:
{
"name": "sensores",
"version": "0.1.0",
"private": true,
"dependencies": {
"antd": "^3.11.3",
"history": "^4.7.2",
"moment": "^2.23.0",
"pm2": "^3.2.8",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-draggable": "^3.1.1",
"react-form": "^3.5.6",
"react-loader-spinner": "^2.3.0",
"react-redux": "^6.0.0",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-router-redux": "^4.0.8",
"react-scripts": "^2.1.3",
"reactstrap": "^6.5.0",
"recharts": "^1.4.2",
"redux": "^4.0.1",
"redux-form": "^8.0.4",
"redux-logger": "^3.0.6",
"redux-saga": "^0.16.2",
"redux-thunk": "^2.3.0",
"serve": "^10.1.1",
"styled-components": "^4.1.3",
"url-search-params": "^1.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"serve": "json-server --watch ./serverfake.json"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
It does sounds like it's a memory issue, particularly this line:
The build failed because the process exited too early. This probably means the system ran out of memory or someone calledkill -9on the process..
You can check it by running the command top inside the terminal and see the memory usage.

Npm run serve Error

I have a problem with running the command : npm run serve
to fix it i need to logout or reboot my Ubuntu 16.04
I have checked the running tasks and node is not running.
I have also uninstalled node and npm and installed again with NVM but i still have the problem .
Npm error log :
> customer-frontend#0.1.0 serve /home/work/work/git_repositories/xyz/ customer-frontend
> vue-cli-service serve --open
INFO Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
10% building modules 1/1 modules 0 activeevents.js:183
throw er; // Unhandled 'error' event
^
Error: watch /home/work/work/git_repositories/xyz/customer-frontend/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1374:19)
at Object.fs.watch (fs.js:1400:11)
at createFsWatchInstance (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! customer-frontend#0.1.0 serve: `vue-cli-service serve --open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the s customer-frontend#0.1.0 serve 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! /home/work/.npm/_logs/2018-02-27T11_40_39_880Z-debug.log
/home/work/.npm/_logs/2018-02-27T11_40_39_880Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/home/work/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/home/work/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli 'run',
1 verbose cli 'serve' ]
2 info using npm#5.6.0
3 info using node#v8.9.4
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle customer-frontend#0.1.0~preserve: customer-frontend#0.1.0
6 info lifecycle customer-frontend#0.1.0~serve: customer-frontend#0.1.0
7 verbose lifecycle customer-frontend#0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle customer-frontend#0.1.0~serve: PATH: /home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/work/work/git_repositories/XYZ/customer-frontend/node_modules/.bin:/home/work/.nvm/versions/node/v8.9.4/bin:/home/work/bin:/home/work/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
9 verbose lifecycle customer-frontend#0.1.0~serve: CWD: /home/work/work/git_repositories/XYZ/customer-frontend
10 silly lifecycle customer-frontend#0.1.0~serve: Args: [ '-c', 'vue-cli-service serve --open' ]
11 silly lifecycle customer-frontend#0.1.0~serve: Returned: code: 1 signal: null
12 info lifecycle customer-frontend#0.1.0~serve: Failed to exec serve script
13 verbose stack Error: customer-frontend#0.1.0 serve: `vue-cli-service serve --open`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid customer-frontend#0.1.0
15 verbose cwd /home/work/work/git_repositories/XYZ/customer-frontend
16 verbose Linux 4.13.0-36-generic
17 verbose argv "/home/work/.nvm/versions/node/v8.9.4/bin/node" "/home/work/.nvm/versions/node/v8.9.4/bin/npm" "run" "serve"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error customer-frontend#0.1.0 serve: `vue-cli-service serve --open`
22 error Exit status 1
23 error Failed at the customer-frontend#0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The project is based on Vuejs (typescript)
The thing is that i can run "npm run dev" without problem on other projects that are normal Vuejs (not typescript)
this is the Package.json
{
"name": "xyz-customer-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"test": "vue-cli-service test",
"e2e": "vue-cli-service e2e",
"e2e:open": "vue-cli-service e2e:open"
},
"dependencies": {
"axios": "^0.17.1",
"buefy": "^0.6.3",
"bulma": "^0.6.2",
"echarts": "^4.0.2",
"register-service-worker": "^1.0.0",
"vue": "^2.5.13",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^6.0.0",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-class": "^0.3.0",
"vuex-persistedstate": "^2.4.2"
},
"devDependencies": {
"#types/chai": "^4.1.0",
"#types/mocha": "^2.2.46",
"#vue/cli-plugin-babel": "^3.0.0-beta.1",
"#vue/cli-plugin-e2e-cypress": "^3.0.0-beta.1",
"#vue/cli-plugin-pwa": "^3.0.0-beta.1",
"#vue/cli-plugin-typescript": "^3.0.0-beta.1",
"#vue/cli-plugin-unit-mocha": "^3.0.0-beta.1",
"#vue/cli-service": "^3.0.0-beta.1",
"#vue/test-utils": "^1.0.0-beta.10",
"chai": "^4.1.2",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6",
"vue-template-compiler": "^2.5.13"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
Node Version : v8.9.4
Npm Version : v5.6.0
Thanks for your time .
Running this code have solved my problem on ubuntu 16.04
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Honestly, I don't know why this Error occurred!
But, once I tested it with sudo in terminal, it worked:
sudo npm run serve
or, for development:
sudo npm run dev
if you are getting problem to run command npm run serve than just delete your "node_modules" folder from your project and run command npm i or npm install which just run anyone command. This command will install your "node_modules" folder
again and with new and good dependencies now you are ready to use command
npm run serve
Thanks

Angular 2 local development environment runs only once after install, reproducibly

Following the local development setup instructions for Angular 2 at https://angular.io/docs/ts/latest/guide/setup.html on Windows 10 works for the first run of the local development environment. Both "npm install" and "npm start" work fine. However, after closing all programs and trying again to run "npm start" there are console errors and an error log file, but the browser doesn't open.
Three times I've done a fresh install/start on Angular's quickstart files, and each time it fails to run after the initial setup as described above.
Solutions in other threads didn't work or were not applicable, but I'm including the contents of package.json since some issues previously discussed have referenced that file.
I followed the instructions in the command line outputs to report the problem to the "author" but got no response.
The "Report issues" link at https://angular.io/docs/ts/latest/guide/learning-angular.html directs people to pose questions on GitHub, but the administrators on GitHub respond to a detailed post in their particular format within 20 seconds saying to post instead on StackOverflow.
I'd appreciate help in workarounds or suggestions on how to actually report problems to the Angular folks.
Here are the 3 items that seem most relevant:
command line:
C:\Users\username\Documents\js\quickstart>npm start
> angular-quickstart#1.0.0 prestart C:\Users\username\Documents\js\quickstart
> npm run build
> angular-quickstart#1.0.0 build C:\Users\username\Documents\js\quickstart
> tsc -p src/
src/app/hero.service.ts(22,2): error TS2393: Duplicate function implementation.
src/app/hero.service.ts(34,2): error TS2393: Duplicate function implementation.
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" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart#1.0.0 build: `tsc -p src/`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 build script 'tsc -p src/'.
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 angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc -p src/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\username\Documents\js\quickstart\npm-debug.log
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" "start"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart#1.0.0 prestart: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 prestart script 'npm run build'.
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 angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\username\Documents\js\quickstart\npm-debug.log
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 'start' ]
2 info using npm#3.10.10
3 info using node#v6.9.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart#1.0.0~prestart: angular-quickstart#1.0.0
6 verbose lifecycle angular-quickstart#1.0.0~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle angular-quickstart#1.0.0~prestart: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\username\Documents\js\quickstart\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;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)\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\nodejs\;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Roaming\npm
8 verbose lifecycle angular-quickstart#1.0.0~prestart: CWD: C:\Users\username\Documents\js\quickstart
9 silly lifecycle angular-quickstart#1.0.0~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle angular-quickstart#1.0.0~prestart: Returned: code: 1 signal: null
11 info lifecycle angular-quickstart#1.0.0~prestart: Failed to exec prestart script
12 verbose stack Error: angular-quickstart#1.0.0 prestart: `npm run build`
12 verbose stack Exit status 1
12 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at EventEmitter.emit (events.js:191:7)
12 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at ChildProcess.emit (events.js:191:7)
12 verbose stack at maybeClose (internal/child_process.js:877:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
13 verbose pkgid angular-quickstart#1.0.0
14 verbose cwd C:\Users\username\Documents\js\quickstart
15 error Windows_NT 10.0.14393
16 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
17 error node v6.9.5
18 error npm v3.10.10
19 error code ELIFECYCLE
20 error angular-quickstart#1.0.0 prestart: `npm run build`
20 error Exit status 1
21 error Failed at the angular-quickstart#1.0.0 prestart script 'npm run build'.
21 error Make sure you have the latest version of node.js and npm installed.
21 error If you do, this is most likely a problem with the angular-quickstart package,
21 error not with npm itself.
21 error Tell the author that this fails on your system:
21 error npm run build
21 error You can get information on how to open an issue for this project with:
21 error npm bugs angular-quickstart
21 error Or if that isn't available, you can get their info via:
21 error npm owner ls angular-quickstart
21 error There is likely additional logging output above.
22 verbose exit [ 1, true ]
package.json
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"#angular/common": "~2.4.0",
"#angular/compiler": "~2.4.0",
"#angular/core": "~2.4.0",
"#angular/forms": "~2.4.0",
"#angular/http": "~2.4.0",
"#angular/platform-browser": "~2.4.0",
"#angular/platform-browser-dynamic": "~2.4.0",
"#angular/router": "~3.4.0",
"angular-in-memory-web-api": "~0.2.4",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.7.4"
},
"devDependencies": {
"concurrently": "^3.1.0",
"lite-server": "^2.2.2",
"typescript": "~2.0.10",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"#types/node": "^6.0.46",
"#types/jasmine": "^2.5.36"
},
"repository": {}
}
The more fundamental answer is to use an IDE such as https://code.visualstudio.com/ that will flag errors in the code regardless of when they occurred. The combination of VSCode with extensions such as the following prevents annoyances such as described in this thread:
TypeScript Hero
TSLint
angular2-inline
I figured this out. The error was pointed out by these lines:
src/app/hero.service.ts(22,2): error TS2393: Duplicate function implementation.
src/app/hero.service.ts(34,2): error TS2393: Duplicate function implementation.
Fixing the error in the hero.service.ts file fixed the problem. The confusing part was that the files kept working while the local development environment was running, despite having an error. The error was only evident when restarting the server.
In another demo folder there was another error, a missing comma in an #NGModule declarations array. The same issue occurred - the local development environment didn't complain while it was still open, but wouldn't restart.
This sounds like it could be a caching problem, and like caching problems it was confusing to someone unfamiliar with this environment.

webpack-dev-server fails to run

I am new to reactjs and webpack. So I am trying the following awesome video to install webpack and dev server:
Setup Workspace with Webpack
and here is the sample project I am working on:
project
I did everything step by step and now when I run npm start I get the following error:
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 'start' ]
2 info using npm#3.10.10
3 info using node#v7.2.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle reactjs-basics#1.0.0~prestart: reactjs-basics#1.0.0
6 silly lifecycle reactjs-basics#1.0.0~prestart: no script for prestart, continuing
7 info lifecycle reactjs-basics#1.0.0~start: reactjs-basics#1.0.0
8 verbose lifecycle reactjs-basics#1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle reactjs-basics#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\tj\reactjs-basics\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32 ;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\CCM;C:\WINDOWS\CCM;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\Java\jdk1.8.0_111\bin;C:\Users\hminaee\AppData\Roaming\npm
10 verbose lifecycle reactjs-basics#1.0.0~start: CWD: C:\tj\reactjs-basics
11 silly lifecycle reactjs-basics#1.0.0~start: Args: [ '/d /s /c', 'npm run build' ]
12 silly lifecycle reactjs-basics#1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle reactjs-basics#1.0.0~start: Failed to exec start script
14 verbose stack Error: reactjs-basics#1.0.0 start: `npm run build`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255: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:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid reactjs-basics#1.0.0
16 verbose cwd C:\tj\reactjs-basics
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v7.2.1
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error reactjs-basics#1.0.0 start: `npm run build`
22 error Exit status 1
23 error Failed at the reactjs-basics#1.0.0 start script 'npm run build'.
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 reactjs-basics package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run build
23 error You can get information on how to open an issue for this project with:
23 error npm bugs reactjs-basics
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls reactjs-basics
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Also here is my package.json file:
{
"name": "reactjs-basics",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "npm run build",
"build": "webpack -d && cp src/index.html dist/index.html && webpack-dev- server --content-base src/ --inline --hot --port 3003",
"build:prod": "webpack -p && cp src/index.html dist/index.html"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.4.1",
"react-dom": "^15.4.1",
"webpack-dev-server": "^1.16.2"
},
"devDependencies": {
"babel-core": "^6.20.0",
"babel-loader": "^6.2.9",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.18.0",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2"
}
}
I checked the web and I saw many solution regarding to the port. So I change the port to an open port like this : --port 3003 but still webpack-dev-server does not work.
Can anyone help?

Resources