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?
Related
I'm following a course and when I run npm run dev on the code I just downloaded (and that works in the video) I get this error. I've reinstalled node and npm, deleted node_modules folder and packale-lock.json and ran npm install again, doesnt work.
Here's the output
$ npm run dev
> twittor-server-client#1.0.0 dev C:\Users\Administrador\Desktop\PWA\10-twittor-offline-posting
> ./node_modules/nodemon/bin/nodemon.js server/server
"." no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! twittor-server-client#1.0.0 dev: `./node_modules/nodemon/bin/nodemon.js server/server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the twittor-server-client#1.0.0 dev 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\Administrador\AppData\Roaming\npm-cache\_logs\2020-04-12T18_53_06_036Z-debug.log
Here's the debug log:
0 info it worked if it ends with ok
1 verbose cli [
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 'dev'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.2
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle twittor-server-client#1.0.0~predev: twittor-server-client#1.0.0
6 info lifecycle twittor-server-client#1.0.0~dev: twittor-server-client#1.0.0
7 verbose lifecycle twittor-server-client#1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle twittor-server-client#1.0.0~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Administrador\Desktop\PWA\10-twittor-offline-posting\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Administrador\bin;C:\Program Files\Microsoft MPI\Bin;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Crucial\Crucial Storage Executive;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Java\jdk1.8.0_201\bin;C:\apache-ant-1.10.7\bin;C:\Users\ Usuario\IdeaProjects\mysql-connector-java-5.1.48;C:\ProgramData\chocolatey\bin;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Git\cmd;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\MinGW\bin;C:\Program Files\nodejs;C:\Users\Administrador\AppData\Roaming\local\bin;C:\Users\Administrador\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrador\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Administrador\AppData\Roaming\npm
9 verbose lifecycle twittor-server-client#1.0.0~dev: CWD: C:\Users\Administrador\Desktop\PWA\10-twittor-offline-posting
10 silly lifecycle twittor-server-client#1.0.0~dev: Args: [ '/d /s /c', './node_modules/nodemon/bin/nodemon.js server/server' ]
11 silly lifecycle twittor-server-client#1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle twittor-server-client#1.0.0~dev: Failed to exec dev script
13 verbose stack Error: twittor-server-client#1.0.0 dev: `./node_modules/nodemon/bin/nodemon.js server/server`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:310:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:310:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid twittor-server-client#1.0.0
15 verbose cwd C:\Users\Administrador\Desktop\PWA\10-twittor-offline-posting
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.16.2
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error twittor-server-client#1.0.0 dev: `./node_modules/nodemon/bin/nodemon.js server/server`
22 error Exit status 1
23 error Failed at the twittor-server-client#1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
And the package.json:
{
"name": "twittor-server-client",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server/server.js",
"dev": "./node_modules/nodemon/bin/nodemon.js server/server"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.16.3"
},
"devDependencies": {
"nodemon": "^1.18.4",
"webpack-dev-server": "^3.10.3"
}
}
Says in the output that the "." in front of the dev script path is not recognized but this is all auto-generated...
I guess, npm cache clean && rm -rf node_modules && npm i should work.
But since you already have nodemon in your dev dependencies. Try
replacing the dev script with "nodemon server/server.js" – Rahul
Sharma Apr 12 at 19:28I guess, npm cache clean && rm -rf node_modules
&& npm i should work. But since you already have nodemon in your dev
dependencies. Try replacing the dev script with "nodemon
server/server.js" – Rahul Sharma Apr 12 at 19:28
This command worked for me:
{
"name": "twittor-server-client",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server/server.js",
"dev": "nodemon server/server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3"
},
"devDependencies": {
"nodemon": "^1.18.4"
}
}
Hope it can help you #Julian
In my laravel app, after updating to laravel-mix v4, when I run npm run watch, I get the error:
webpack not installed,
consider installing it using npm install
--save-dev webpack
Even when Webpack v4.33.0 is clearly installed & available in my node_modules. Here is my package.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --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 --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 --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
...
"laravel-mix": "^4.0.16",
"webpack": "^4.33.0"
}
}
Here is my webpack.mix.js:
mix.js('resources/assets/js/app.js','public/js/app.js')
.browserSync({
proxy: 'app.test',
notify: false,
open: true,
port: 8080
})
.options({
extractVueStyles: OUTPUTCSS + 'app.css'
});
This wasn't an issue prior to updating my laravel-mix to v4, what seems to be the issue?
--- UPDATE ---
Here is the npm debug log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'watch' ]
2 info using npm#6.2.0
3 info using node#v10.9.0
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle #~prewatch: #
6 info lifecycle #~watch: #
7 verbose lifecycle #~watch: unsafe-perm in lifecycle true
8 verbose lifecycle #~watch: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/main_user/projects/test_project/node_modules/.bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
9 verbose lifecycle #~watch: CWD: /Users/main_user/projects/test_project
10 silly lifecycle #~watch: Args: [ '-c', 'npm run development -- --watch' ]
11 silly lifecycle #~watch: Returned: code: 1 signal: null
12 info lifecycle #~watch: Failed to exec watch script
13 verbose stack Error: # watch: `npm run development -- --watch`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
13 verbose stack at EventEmitter.emit (events.js:182: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:182:13)
13 verbose stack at maybeClose (internal/child_process.js:961:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
14 verbose pkgid #
15 verbose cwd /Users/main_user/projects/test_project
16 verbose Darwin 18.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch"
18 verbose node v10.9.0
19 verbose npm v6.2.0
20 error code ELIFECYCLE
21 error errno 1
22 error # watch: `npm run development -- --watch`
22 error Exit status 1
23 error Failed at the # watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Found a similar issue over at webpack/webpack-cli#944
this appears to happen when the webpack.config.js module require()s a missing module or requires are not installed using npm
You can also try change webpack-cli version to 2.1.3
Verify you are not using any deprecated plugins. I had to change GlobCopyWebpackPlugin to CopyWebpackPlugin
Please note I have tried what related stack overflow topics have suggested. I've reached the end point of a tutorial for starting a react app and everything installs and runs till the last part.
I'm following the tutorial here:
React Tutorial
I've researched the error codes and redone the whole process 3 times making sure everything matches but it just won't work.
Everything seems to install and work fine until I reach the very bottom of the tutorial when it asks to do type npm start on the command prompt.
This is the error I get each time after I run that:
This is my package.json, exactly following how the tutorial writes it and told me to change "test" "echo \"Error: no test specified\" && exit 1" instead the script object to "start": "webpack-dev-server --hot".
{
"name": "reactapp",
"version": "1.0.0",
"description": "First React App",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "Kranti Nebhwani",
"license": "ISC",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"webpack": "^4.6.0",
"webpack-dev-server": "^3.1.3"
},
"devDependencies": {
"webpack-cli": "^2.0.15"
}
}
And finally my error log that npm logs out mentioned in the command line:
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#5.6.0
3 info using node#v8.11.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle reactapp#1.0.0~prestart: reactapp#1.0.0
6 info lifecycle reactapp#1.0.0~start: reactapp#1.0.0
7 verbose lifecycle reactapp#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle reactapp#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Kranti\Desktop\reactApp\node_modules\.bin;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)\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 (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Users\Kranti\AppData\Local\Microsoft\WindowsApps;C:\Users\Kranti\AppData\Local\atom\bin;C:\Users\Kranti\AppData\Local\Microsoft\WindowsApps;C:\Python27;C:\Users\Kranti\AppData\Roaming\npm
9 verbose lifecycle reactapp#1.0.0~start: CWD: C:\Users\Kranti\Desktop\reactApp
10 silly lifecycle reactapp#1.0.0~start: Args: [ '/d /s /c', 'webpack-dev-server --hot' ]
11 silly lifecycle reactapp#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle reactapp#1.0.0~start: Failed to exec start script
13 verbose stack Error: reactapp#1.0.0 start: `webpack-dev-server --hot`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\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> (C:\Program Files\nodejs\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 reactapp#1.0.0
15 verbose cwd C:\Users\Kranti\Desktop\reactApp
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v8.11.1
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error reactapp#1.0.0 start: `webpack-dev-server --hot`
22 error Exit status 1
23 error Failed at the reactapp#1.0.0 start 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 failed at getting react set up multiple times during last year each time following a different tutorial and it's really demotivating as I check and make sure everything is right. Hopefully someone with more experience can see something I don't or know what the error is as I really want to get react running on my system. I'm too poor for a mac system at the moment though I've heard it's easier to set up there and pretty much all tutorials on youtube show it with a mac. Thanks for your time.
The tutorial assumes you are using webpack 1 (tutorial is very old). But you installed webpack 4. Since webpack version 2, property loaders has been renamed to rules and smaller changes have been done. This is why webpack tells you your webpack.config.js is wrong. So you have two options here:
Rename and change your loaders props to match the new rules prop. This might help: https://javascriptplayground.com/moving-to-webpack-2/
Install webpack in version 1: npm install webpack#1.x --save-dev
Or take another tutorial.
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
I am learning laravel and when I tried to run npm install dev in integrated terminal of VS Code, it shows error.
Versions I am using.
enter image description here
Console:
enter image description here
Log file report: 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 'dev' ]
2 info using npm#5.5.1
3 info using node#v9.3.0
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:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\xampp\htdocs\myapp\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Avishek\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\nodejs;C:\Users\Avishek\AppData\Local\Microsoft\WindowsApps;C:\Users\Avishek\AppData\Roaming\Composer\vendor\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\Avishek\AppData\Roaming\npm
9 verbose lifecycle #~dev: CWD: C:\xampp\htdocs\myapp
10 silly lifecycle #~dev: Args: [ '/d /s /c', 'npm run development' ]
11 silly lifecycle #~dev: Returned: code: 2 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev:npm run development
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack at EventEmitter.emit (events.js:159:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:159:13)
13 verbose stack at maybeClose (internal/child_process.js:943:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid #
15 verbose cwd C:\xampp\htdocs\myapp
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v9.3.0
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 2
22 error # dev:npm run development
22 error Exit status 2
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 [ 2, true ]
package.json contents:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"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 --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 --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.17",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.5.7"
}
}
just do npm install if the issue persist try to add --ignore-platform-reqs
The command must be npm install --dev, you just missed the 2 dashes.