I am just starting to learn react and I'm following the first part of this tutorial. https://www.codecademy.com/articles/how-to-create-a-react-app
I have run the following commands in Terminal:
npm install -g create-react-app
create-react-app ravenous
# I've also tried npx create-react-app ravenous as per the official React website)
# Both timesI receive a successful output that ends with 'Happy hacking'
cd ravenous
npm start
But I receive the following error in the terminal.
npm start
> ravenous#0.1.0 start /Users/sarah/sites/ravenous
> react-scripts start
module.js:559
throw err;
^
Error: Cannot find module '#webassemblyjs/ast'
at Function.Module._resolveFilename (module.js:557:15)
at Function.Module._load (module.js:484:25)
at Module.require (module.js:606:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/sarah/sites/ravenous/node_modules/webpack/lib/wasm/WebAssemblyParser.js:7:11)
at Module._compile (module.js:662:30)
at Object.Module._extensions..js (module.js:673:10)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ravenous#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ravenous#0.1.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! /Users/sarah/.npm/_logs/2018-10-16T17_12_05_840Z-debug.log
In node_modules I do have the #webassemblyjs/ast folder.
The debug.log has this:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm#5.6.0
3 info using node#v9.6.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ravenous#0.1.0~prestart: ravenous#0.1.0
6 info lifecycle ravenous#0.1.0~start: ravenous#0.1.0
7 verbose lifecycle ravenous#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle ravenous#0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/s$
9 verbose lifecycle ravenous#0.1.0~start: CWD: /Users/sarah/sites/ravenous
10 silly lifecycle ravenous#0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle ravenous#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle ravenous#0.1.0~start: Failed to exec start script
13 verbose stack Error: ravenous#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at EventEmitter.emit (events.js:127: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:127:13)
13 verbose stack at maybeClose (internal/child_process.js:933:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid ravenous#0.1.0
15 verbose cwd /Users/sarah/sites/ravenous
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v9.6.1
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error ravenous#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the ravenous#0.1.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 ]
Here is my ravenous/package.json
{
"name": "ravenous",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "2.0.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
I've checked the folder permissions on the filesystem once the ravenous folder is created, set everything to Read & Write and then retried npm start but this doesn't seem to make a difference.
I've tried deleting package-lock.json and node_modules and rerunning npm install. It doesn't help the issue although strangely package-lock.json is not recreated when I do this.
I am on Mac OS Sierra 10.12.6
npm -v gives me 5.6.0
node -v gives me 9.6.1
I downloaded the "recommended for most users" release of Node.js (currently 8.12.0 LTS) and reinstalled node.
I'm now on node 8.12.0 and npm 6.4.1 and npm start is now working.
Related
When I use npm run serve, I get following message.
PS C:\Users\Jan\Desktop\projektgruppe\Main> npm run serve
> editor#0.1.0 serve C:\Users\Jan\Desktop\projektgruppe\Main
> concurrently "nodemon -L --inspect=0.0.0.0:9001 ./server/index.js" "vue-cli-service build ./src/main.js --mode development --watch"
[0] Error occurred when executing command: nodemon -L --inspect=0.0.0.0:9001 ./server/index.js
[0] Error: spawn cmd.exe ENOENT
[0] at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
[0] at onErrorNT (internal/child_process.js:456:16)
[0] at processTicksAndRejections (internal/process/task_queues.js:81:21)
[1] Error occurred when executing command: vue-cli-service build ./src/main.js --mode development --watch
[1] Error: spawn cmd.exe ENOENT
[1] at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
[1] at onErrorNT (internal/child_process.js:456:16)
[1] at processTicksAndRejections (internal/process/task_queues.js:81:21)
[1] vue-cli-service build ./src/main.js --mode development --watch exited with code -4058
[0] nodemon -L --inspect=0.0.0.0:9001 ./server/index.js exited with code -4058
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! editor#0.1.0 serve: `concurrently "nodemon -L --inspect=0.0.0.0:9001 ./server/index.js" "vue-cli-service build ./src/main.js --mode development --watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the editor#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
and my log file is this
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\node\\node.exe',
1 verbose cli 'C:\\Program Files\\node\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'serve'
1 verbose cli ]
2 info using npm#6.13.6
3 info using node#v12.14.1
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle editor#0.1.0~preserve: editor#0.1.0
6 info lifecycle editor#0.1.0~serve: editor#0.1.0
7 verbose lifecycle editor#0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle editor#0.1.0~serve: PATH: C:\Program Files\node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Jan\Desktop\projektgruppe\Main\node_modules\.bin;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\node\;C:\Program Files\Git\cmd;C:\Users\Jan\AppData\Local\Microsoft\WindowsApps;C:\Users\Jan\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Jan\AppData\Roaming\npm
9 verbose lifecycle editor#0.1.0~serve: CWD: C:\Users\Jan\Desktop\projektgruppe\Main
10 silly lifecycle editor#0.1.0~serve: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'concurrently "nodemon -L --inspect=0.0.0.0:9001 ./server/index.js" "vue-cli-service build ./src/main.js --mode development --watch"'
10 silly lifecycle ]
11 silly lifecycle editor#0.1.0~serve: Returned: code: 1 signal: null
12 info lifecycle editor#0.1.0~serve: Failed to exec serve script
13 verbose stack Error: editor#0.1.0 serve: `concurrently "nodemon -L --inspect=0.0.0.0:9001 ./server/index.js" "vue-cli-service build ./src/main.js --mode development --watch"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\node\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:223:5)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\node\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:223:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid editor#0.1.0
15 verbose cwd C:\Users\Jan\Desktop\projektgruppe\Main
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\node\\node.exe" "C:\\Program Files\\node\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve"
18 verbose node v12.14.1
19 verbose npm v6.13.6
20 error code ELIFECYCLE
21 error errno 1
22 error editor#0.1.0 serve: `concurrently "nodemon -L --inspect=0.0.0.0:9001 ./server/index.js" "vue-cli-service build ./src/main.js --mode development --watch"`
22 error Exit status 1
23 error Failed at the editor#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 ]
It always worked, but now not. I tried many times to uninstall node modules. I reinstalled many times node, but I can not find the mistake. I have no Problem, when I just build it and start it. But that is not nice for development.
"start": "node ./server/index.js",
"serve": "concurrently \"nodemon -L --inspect=0.0.0.0:9001 ./server/index.js\" \"vue-cli-service build ./src/main.js --mode development --watch\"",
"build": "vue-cli-service build ./src/main.js",
Would be so glad for any help.
Thanks
I was trying to learn react, so I have this sample code of my first react app, and I am trying to get it work but after running npm install followed by npm start I receive the following error:
C:\Users\Ak\Desktop\reactapp>npm start
> reactapp#1.0.0 start C:\Users\Ak\Desktop\reactapp
> webpack-dev-server --hot
The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\Ak\Desktop\reactapp\node_modules\webpack-dev-server\bin\webpack-dev-server.js:60:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactapp#1.0.0 start: `webpack-dev-server --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp#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\Ak\AppData\Roaming\npm-cache\_logs\2019-06-07T07_08_01_594Z-debug.log
Don't know how to solve this issue.
Here is my log file.
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#6.9.0
3 info using node#v10.16.0
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\Ak\Desktop\reactapp\node_modules\.bin;G:\Software files\Python\Scripts\;G:\Software files\Python\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;G:\Software files\Brackets Editor\command;C:\Program Files\nodejs\;C:\Users\Ak\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\Ak\AppData\Local\Programs\Python\Python36\;G:\Software files\Java\bin;C:\Users\Ak\AppData\Local\Microsoft\WindowsApps;G:\Software files\NMDVPN\bin;C:\Users\Ak\AppData\Roaming\npm
9 verbose lifecycle reactapp#1.0.0~start: CWD: C:\Users\Ak\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:301:16)
13 verbose stack at EventEmitter.emit (events.js:198: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: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 reactapp#1.0.0
15 verbose cwd C:\Users\Ak\Desktop\reactapp
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.16.0
19 verbose npm v6.9.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 ]
Here is my package.json file:
{
"name": "reactapp",
"version": "1.0.0",
"description": "Learning ReactJs with AK",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"keywords": [
"npm",
"learn",
"react"
],
"author": "AK",
"license": "UNLICENSED",
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"webpack": "^4.33.0",
"webpack-dev-server": "^3.7.0"
}
}
I have installed the react using Nodejs through npm installer.
The first 3 lines of the error message advise what to do.
You need to install webpack-cli in order to run the webpack-dev-server. If you run the command it's giving you, you'll install webpack-cli as a devDependency and it'll all run.
If you're going to be using webpack a lot going forward it may be worth installing it globally, rather than needing to add it each time.
The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
I'm encoutering an error when trying to run 'npm run watch', a command to run the laravel mix watcher.
In Short
1. It works on my Macbook, same OS version, same NPM version, same project.
2. I tried reïnstalling nodeJS and removed my node_modules.
3. I tried all kinds of solutions on stack overflow based on the first
line on the error log (error: Chunk.entrypoints (...)).
Here is the error log:
Johrs-iMac:tdc-roots johrclaessens$ npm run watch
> pagekit#1.0.0 watch /Users/johrclaessens/stack/TDC/Web/projects/tdc-roots
> NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
10% building modules 1/1 modules 0 active
webpack is watching the files…
77% module and chunk tree optimization unnamed compat plugin/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/webpack/lib/Chunk.js:460
throw new Error(
^
Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
at Chunk.get (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/webpack/lib/Chunk.js:460:9)
at /Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/laravel-mix/node_modules/extract-text-webpack-plugin/dist/index.js:176:48
at Array.forEach (<anonymous>)
at /Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/laravel-mix/node_modules/extract-text-webpack-plugin/dist/index.js:171:18
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:12:1)
at AsyncSeriesHook.lazyCompileHook (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/tapable/lib/Hook.js:154:20)
at Compilation.seal (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/webpack/lib/Compilation.js:881:27)
at hooks.make.callAsync.err (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/webpack/lib/Compiler.js:464:17)
at _err0 (eval at create (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:11:1)
at _addModuleChain (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/webpack/lib/Compilation.js:749:12)
at processModuleDependencies.err (/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/webpack/lib/Compilation.js:688:9)
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pagekit#1.0.0 watch: `NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pagekit#1.0.0 watch 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/johrclaessens/.npm/_logs/2018-10-24T20_33_19_843Z-debug.log
And npm's error 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.4.1
3 info using node#v8.12.0
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle pagekit#1.0.0~prewatch: pagekit#1.0.0
6 info lifecycle pagekit#1.0.0~watch: pagekit#1.0.0
7 verbose lifecycle pagekit#1.0.0~watch: unsafe-perm in lifecycle true
8 verbose lifecycle pagekit#1.0.0~watch: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/johrclaessens/stack/TDC/Web/projects/tdc-roots/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/johrclaessens/.nexustools:/Applications/DevDesktop/tools
9 verbose lifecycle pagekit#1.0.0~watch: CWD: /Users/johrclaessens/stack/TDC/Web/projects/tdc-roots
10 silly lifecycle pagekit#1.0.0~watch: Args: [ '-c',
10 silly lifecycle 'NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle pagekit#1.0.0~watch: Returned: code: 1 signal: null
12 info lifecycle pagekit#1.0.0~watch: Failed to exec watch script
13 verbose stack Error: pagekit#1.0.0 watch: `NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
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 emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
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 emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:915:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid pagekit#1.0.0
15 verbose cwd /Users/johrclaessens/stack/TDC/Web/projects/tdc-roots
16 verbose Darwin 18.0.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch"
18 verbose node v8.12.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error pagekit#1.0.0 watch: `NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the pagekit#1.0.0 watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Can anyone help me with a fix?
Thanks in advance!
The problem was solved by deleting the project directory and a git clone from the source. a quick npm install and laravel mix ran without any problems.
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 trying to prerender charts with dc.js using npm
but when i include dc in my code it throws error, I am a nwebie in node.js, Tried searching for answers no luck, may be it should be a version error i learnt that jsdom version > 1 has no createWindow(); methord but changing version and calling npm install and update dint work either.. Any Help is much appriciated, thanks in advance
my package.json
{
"name": "binode",
"version": "1.0.0",
"description": "binode testing",
"main": "index.js",
"scripts": {
"start": "node index"
},
"author": "abc",
"license": "MIT",
"dependencies": {
"body-parser": "^1.13.3",
"d3": "^3.5.6",
"dc": "^1.7.3",
"express": "^4.13.3",
"jsdom": "^1.5.0"
}
}
Error :
/learn/nodeSample/biNode/node_modules/dc/globals.js:2
window = global.window = document.createWindow();
^
TypeError: undefined is not a function
at Object.<anonymous> (/Volumes/Official/learn/nodeSample/biNode/node_modules/dc/globals.js:2:39)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Volumes/Official/learn/nodeSample/biNode/node_modules/dc/index.js:8:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.7
npm ERR! npm v2.14.1
npm ERR! code ELIFECYCLE
npm ERR! binode#1.0.0 start: `node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the binode#1.0.0 start script 'node index'.
npm ERR! This is most likely a problem with the binode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index
npm ERR! You can get their info via:
npm ERR! npm owner ls binode
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Volumes/Official/learn/nodeSample/biNode/npm-debug.log
npm-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ]
2 info using npm#2.14.1
3 info using node#v0.12.7
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart binode#1.0.0
7 info start binode#1.0.0
8 verbose unsafe-perm in lifecycle true
9 info binode#1.0.0 Failed to exec start script
10 verbose stack Error: binode#1.0.0 start: `node index`
10 verbose stack Exit status 1
10 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
10 verbose stack at EventEmitter.emit (events.js:110:17)
10 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack at ChildProcess.emit (events.js:110:17)
10 verbose stack at maybeClose (child_process.js:1015:16)
10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid binode#1.0.0
12 verbose cwd /Volumes/Official/learn/nodeSample/biNode
13 error Darwin 14.5.0
14 error argv "node" "/usr/local/bin/npm" "start"
15 error node v0.12.7
16 error npm v2.14.1
17 error code ELIFECYCLE
18 error binode#1.0.0 start: `node index`
18 error Exit status 1
19 error Failed at the binode#1.0.0 start script 'node index'.
19 error This is most likely a problem with the binode package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error node index
19 error You can get their info via:
19 error npm owner ls binode
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
my simple js file:
var express = require('express');
var app = express();
var d3 = require('d3');
var dc = require('dc');
var crossfilter = require('crossfiler');
var jsdom = require('jsdom');
global.d3 = d3;
var port = 2000;
app.listen(port,function(){
console.log("app listing port "+port)
});
i was just getting started at the beginning itself it threw error
I tried running npm install inside node_modules/dc
Then there was one more issue index.js no dc is defined added
changed require('./dc') to dc =require('./dc')
Now its working..