My environment:
Centos7 via VirtualBox (installed on Windows7)
Node version: 6.10.3
Npm version : 3.10.10
I'm behind a corporate proxy
I initialized a new project "vuetest" with vue-cli, and now I want to run a webpack server.
I use the following command:
npm run dev
This command is equivalent to "webpack-dev-server --open --hot", here is my "package.json" file to check:
{
"name": "vuetest",
"description": "A Vue.js project",
"version": "1.0.0",
"author": "",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^2.3.3"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-env": "^1.5.1",
"cross-env": "^3.2.4",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^12.1.0",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
}
}
But I get the following error:
> vuetest#1.0.0 dev /var/www/html/vuetest
> cross-env NODE_ENV=development webpack-dev-server --open --hot
Project is running at http://localhost:8080/
webpack output is served from /dist/
404s will fallback to /index.html
internal/child_process.js:319
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:1018:11)
at ChildProcess.spawn (internal/child_process.js:319:11)
at Object.exports.spawn (child_process.js:378:9)
at module.exports (/var/www/html/vuetest/node_modules/opn/index.js:75:24)
at reportReadiness (/var/www/html/vuetest/node_modules/webpack-dev-server/bin/webpack-dev-server.js:424:3)
at Server.<anonymous> (/var/www/html/vuetest/node_modules/webpack-dev-server/bin/webpack-dev-server.js:404:4)
at Server.g (events.js:292:16)
at emitNone (events.js:86:13)
at Server.emit (events.js:185:7)
at emitListeningNT (net.js:1284:10)
npm ERR! Linux 3.10.0-514.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! vuetest#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vuetest#1.0.0 dev script 'cross-env NODE_ENV=development webpack-dev-server --open --hot'.
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 vuetest package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=development webpack-dev-server --open --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vuetest
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vuetest
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/vuetest/npm-debug.log
Here's the contents of the "npm-debug.log" file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm#3.10.10
3 info using node#v6.10.3
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle vuetest#1.0.0~predev: vuetest#1.0.0
6 silly lifecycle vuetest#1.0.0~predev: no script for predev, continuing
7 info lifecycle vuetest#1.0.0~dev: vuetest#1.0.0
8 verbose lifecycle vuetest#1.0.0~dev: unsafe-perm in lifecycle true
9 verbose lifecycle vuetest#1.0.0~dev: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/var/www/html/vuetest/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/bdupre/.local/bin:/home/bdupre/bin
10 verbose lifecycle vuetest#1.0.0~dev: CWD: /var/www/html/vuetest
11 silly lifecycle vuetest#1.0.0~dev: Args: [ '-c',
11 silly lifecycle 'cross-env NODE_ENV=development webpack-dev-server --open --hot' ]
12 silly lifecycle vuetest#1.0.0~dev: Returned: code: 1 signal: null
13 info lifecycle vuetest#1.0.0~dev: Failed to exec dev script
14 verbose stack Error: vuetest#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/lib/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> (/usr/lib/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:886:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid vuetest#1.0.0
16 verbose cwd /var/www/html/vuetest
17 error Linux 3.10.0-514.el7.x86_64
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
19 error node v6.10.3
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error vuetest#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
22 error Exit status 1
23 error Failed at the vuetest#1.0.0 dev script 'cross-env NODE_ENV=development webpack-dev-server --open --hot'.
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 vuetest package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error cross-env NODE_ENV=development webpack-dev-server --open --hot
23 error You can get information on how to open an issue for this project with:
23 error npm bugs vuetest
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls vuetest
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Does anyone know how to fix it please?
I found the solution.
In the "package.json" file, I replaced:
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot"
By this :
"dev": "cross-env NODE_ENV=development webpack-dev-server --port 8080 --hot --host 0.0.0.0"
And now everything works, my server, starts up normally.
As Emil said, this is a problem with opn module, because xdg-open is not executable.
I have the same problem in a project generated with vue-cli, that uses opn 5.1.0.
Simply doing chmod +x node_modules/opn/xdg-open will solve this. But each time node module is updated this change will be lost.
I ended up commenting the call to opn in build/dev-server.js:
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
//opn(uri)
}
and opening manually my browser on http://localhost:8080
node_modules/opn/xdg-open is not executable, if you're on linux this is what fails at opn/index.js line 75
or add this
console.log(cmd, args, cpOpts);
before line 75 in node_modules/opn/index.js to see exactly which command fails
can you check if the port 8080 for your dev server is already in use? Just hit http://localhost:8080 in your browser or change the port in the webpack.config.js and try again. I had a similar issue, maybe thats it.
Checking at your trace log, this problem occur into module opn, exactly in line 75 of index.js
Error: spawn EACCES
at exports._errnoException (util.js:1018:11)
at ChildProcess.spawn (internal/child_process.js:319:11)
at Object.exports.spawn (child_process.js:378:9)
at module.exports (/var/www/html/vuetest/node_modules/opn/index.js:75:24)
looking in that file, we see:
50 } else {
51 if (opts.app) {
52 cmd = opts.app;
53 } else {
54 cmd = path.join(__dirname, 'xdg-open');
55 }
56
57 if (appArgs.length > 0) {
58 args = args.concat(appArgs);
59 }
60
61 if (!opts.wait) {
62 // xdg-open will block the process unless
63 // stdio is ignored even if it's unref'd
64 cpOpts.stdio = 'ignore';
65 }
66 }
67
68 args.push(target);
69
70 if (process.platform === 'darwin' && appArgs.length > 0) {
71 args.push('--args');
72 args = args.concat(appArgs);
73 }
74
75 var cp = childProcess.spawn(cmd, args, cpOpts);
Probably node is trying to run xdg-open which is a bash script so it needs execution permission.
Try :
chmod a+x xdg-open
or, if you are in the root of your project:
chmod a+x node_modules/opn/xdg-open
PS: Usually all these files have correct permissions. In a deseperate situation you always can delete directory node_modules and run npm install again.
Related
I'm in a Laravel 8 project using Docker. Actually I'm in designing with SCSS.
My problem comes up, if I try to compile my SCSS. NPM says, my Node version is on 12.x and way to old, but in my container I use Node version 16.5.
I've tried it with the following commands on command line:
./vendor/bin/sail npm run dev
./vendor/bin/sail npm run watch
It runs into this error:
> # watch /var/www/html
> mix watch
Error: You are using an unsupported version of Node. Please update to at least Node v12.14
at assertSupportedNodeVersion (/var/www/html/node_modules/laravel-mix/src/Engine.js:6:15)
at executeScript (/var/www/html/node_modules/laravel-mix/bin/cli.js:61:5)
at Command.program.command.description.option.option.action (/var/www/html/node_modules/laravel-mix/bin/cli.js:39:13)
at Command.listener [as _actionHandler] (/var/www/html/node_modules/commander/index.js:922:31)
at Command._parseCommand (/var/www/html/node_modules/commander/index.js:1503:14)
at Command._dispatchSubcommand (/var/www/html/node_modules/commander/index.js:1443:18)
at Command._parseCommand (/var/www/html/node_modules/commander/index.js:1460:12)
at Command.parse (/var/www/html/node_modules/commander/index.js:1292:10)
at Command.parseAsync (/var/www/html/node_modules/commander/index.js:1318:10)
at run (/var/www/html/node_modules/laravel-mix/bin/cli.js:50:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `mix watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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! /home/sail/.npm/_logs/2021-08-28T08_08_14_074Z-debug.log
So I've get into my container with docker exec -it <container-id> /bin/bash. There I look for my actual Node version with node -v. It says, that Node version 16.5 is already installed.
That's the content of the complete log file:
root#c20f3997d228:/var/www/html# cat /home/sail/.npm/_logs/2021-08-28T08_09_07_299Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm#6.14.4
3 info using node#v10.19.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: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/html/node_modules/.bin:/root/.nvm/versions/node/v16.5/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle #~dev: CWD: /var/www/html
10 silly lifecycle #~dev: Args: [ '-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> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/share/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 #
15 verbose cwd /var/www/html
16 verbose Linux 5.10.25-linuxkit
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
18 verbose node v10.19.0
19 verbose npm v6.14.4
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 ]
Does anybody has an idea why NPM says, that there is no actual version?
Regards,
Manny
Having come across this same problem myself recently, or more specifically the same wording in the response...
I can state with empirical certainty the issue is NOT your version of NPM, nor is it your version of Node.js, rather it's the version of the dependancy known as "Laravel-mix" which has been pre loaded into your node_modules directory.
In case you aren't aware, the "node_modules" folder is where all your supporting software dependancies get loaded, and increasingly, some of them (like "laravel-mix") are now only supporting very recent versions of Node.js - as in more recent than Mar 2020.
I'm currently seeing this problem pop up on certain versions of Docker, and on versions of Windows 8.1 or earlier. Even AFTER upgrading your version of Node.js the problem is NOT going away because 'laravel-mix" is also cross referencing your Operating System too.
It seems that when "laravel-mix" was upgraded from v5.0 to v6.0 it too fell in to this "very recent versions of Node.js" syndrome. By extension, the default version of "package.json" which now ships with Laravel v8.0 no longer wants 'laravel-mix v5.0", it wants "laravel-mix v6.0".
But there is some good news! Firstly, you do NOT have to use the latest version of "laravel-mix v6.0" in Laravel 8 if you don't want to.
If you do come across this problem, you can work around it by using "parts" of the default version of "package.json" which shipped with Laravel v7.0, which in turn loads the "laravel-mix v5.0" dependancy.
For example... this version of package.json works just great in Laravel 8.0
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.21",
"cross-env": "^7.0.3",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"vue-template-compiler": "^2.6.14"
},
"dependencies": {
"tailwindcss": "^3.0.17"
}
}
Make a backup copy of you "package.json" file and edit it similar to above.
It's perfectly OK to delete your "node_modules" folder, along with your "package-lock.json" file in your root directy. After doing this, you can then re-run "npm install" in your terminal.
You will find "npm run dev" will work without errors after performing these steps.
Yesterday I noticed something very odd after cloning my work groups repository. After installing dependencies with npm install, I could not start the devserver (or run any npm scripts) inside the project. Strange. So I then tried to create my own fresh new project with #vue/cli and the same thing happened there.
Environment:
Node: v14.15.0
NPM: v6.14.8
Globally installed Vue Cli: v4.5.8
macOS Catalina: v10.15.7
Package.json in project:
"name": "eezer_app",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuetify": "^2.2.11",
"vuex": "^3.4.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.19.0",
"sass-loader": "^8.0.0",
"vue-cli-plugin-vuetify": "~2.0.7",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.3.0"
}
}
Error output:
➜ eezer_app git:(master) ✗ npm run serve
> eezer_app#0.1.0 serve /Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app
> vue-cli-service serve
sh: vue-cli-service: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! eezer_app#0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the eezer_app#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! /Users/my-real-name/.npm/_logs/2020-11-03T09_50_50_094Z-debug.log
Debug log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'serve' ]
2 info using npm#6.14.8
3 info using node#v14.15.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle eezer_app#0.1.0~preserve: eezer_app#0.1.0
6 info lifecycle eezer_app#0.1.0~serve: eezer_app#0.1.0
7 verbose lifecycle eezer_app#0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle eezer_app#0.1.0~serve: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle eezer_app#0.1.0~serve: CWD: /Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app
10 silly lifecycle eezer_app#0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 info lifecycle eezer_app#0.1.0~serve: Failed to exec serve script
12 verbose stack Error: eezer_app#0.1.0 serve: `vue-cli-service serve`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1048:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid eezer_app#0.1.0
14 verbose cwd /Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app
15 verbose Darwin 19.6.0
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
17 verbose node v14.15.0
18 verbose npm v6.14.8
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error eezer_app#0.1.0 serve: `vue-cli-service serve`
23 error spawn ENOENT
24 error Failed at the eezer_app#0.1.0 serve script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
Same error shows up in a freshly made Vue project created with vue create as well.
It seems that npm is trying to look for dependency packages globally instead of locally in node_modules, since I can run serve by manually selecting the script in local node_module .bin like this:
./node_modules/.bin/vue-cli-service serve
Then it starts perfectly without any fault, so there is no issue with installed node_modules etc. I have tried fixing this since yesterday with no results. I found tips to clear npm cache, delete local node_modules & package-lock.json but it does not work at all. I even re-installed CLT on my Mac.
What happened with my npm? Why does it seem to look for dependencies in my global node_module?
Appreciate any kind of tips since I have exhausted most of my options.
I updated Node, NPM, all my global node modules, ran brew update, reinstalled xcode: sudo rm -rf /Library/Developer/CommandLineTools then xcode-select --install and it seems to be working again.
Same error shows up in a freshly made Vue project created with vue create as well.
created a fresh vue project using #vue/cli and I was able to run npm run serve. Hopefully this helps for anyone else facing this issue.
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
Whenever I try to run Laravel Mix npm run dev with app.js compilation included on my local Laravel 5.5 project, I get following error:
95% emittingError: EIO: i/o error, close
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development 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/vagrant/.npm/_logs/2018-01-02T17_38_00_013Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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! /home/vagrant/.npm/_logs/2018-01-02T17_38_00_037Z-debug.log
and here is content of log file:
0 info it worked if it ends with ok
1 verbose cli [ '/home/vagrant/.nvm/versions/node/v9.3.0/bin/node',
1 verbose cli '/home/vagrant/.nvm/versions/node/v9.3.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'development' ]
2 info using npm#5.6.0
3 info using node#v9.3.0
4 verbose run-script [ 'predevelopment', 'development', 'postdevelopment' ]
5 info lifecycle aqualis2#~predevelopment: aqualis2#
6 info lifecycle aqualis2#~development: aqualis2#
7 verbose lifecycle aqualis2#~development: unsafe-perm in lifecycle true
8 verbose lifecycle aqualis2#~development: PATH: /home/vagrant/.nvm/versions/node/v9.3.0/lib/node_modules/npm/bin/node-gyp-bin:/home/vagrant/aqualis2/node_modules/.bin:/home/vagrant/.nvm/versions/node/v9.3.0/lib/node_modules/npm/bin/node-gyp-bin:/home/vagrant/aqualis2/node_modules/.bin:/home/vagrant/.nvm/versions/node/v9.3.0/bin:/home/vagrant/.composer/vendor/bin:/home/vagrant/bin:/home/vagrant/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle aqualis2#~development: CWD: /home/vagrant/aqualis2
10 silly lifecycle aqualis2#~development: Args: [ '-c',
10 silly lifecycle 'node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle aqualis2#~development: Returned: code: 1 signal: null
12 info lifecycle aqualis2#~development: Failed to exec development script
13 verbose stack Error: aqualis2# development: `node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/vagrant/.nvm/versions/node/v9.3.0/lib/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> (/home/vagrant/.nvm/versions/node/v9.3.0/lib/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 aqualis2#
15 verbose cwd /home/vagrant/aqualis2
16 verbose Linux 4.4.0-51-generic
17 verbose argv "/home/vagrant/.nvm/versions/node/v9.3.0/bin/node" "/home/vagrant/.nvm/versions/node/v9.3.0/bin/npm" "run" "development"
18 verbose node v9.3.0
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error aqualis2# development: `node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the aqualis2# development 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 webpack.min.js file:
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
// on configure webpack
mix.webpackConfig({
module: {
loaders: [
{
test: require.resolve('pace-progress'),
loader: 'imports?define=>false',
},
],
},
node: {
fs: 'empty',
},
resolve: {
alias: {
'handlebars': 'handlebars/dist/handlebars.js',
},
},
});
// on copie les images non ciblées dans les scripts ou feuilles de style
mix.copy('resources/assets/*', 'public');
mix.copy('resources/assets/images/*', 'public/images');
// on compile/minifie les scripts et on isole les vendors
mix.js('resources/assets/js/app.js', 'public/js')
.extract([
'lodash',
'jquery',
'admin-lte',
'lodash',
'jquery',
'admin-lte',
'pace-progress',
'jquery-slimscroll',
'fastclick',
'bootstrap-datepicker',
'bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min',
'bootstrap-timepicker',
'bootstrap-colorpicker',
'icheck',
'select2',
'daterangepicker',
'handlebars',
'jspdf',
'html2pdf.js',
'datatables.net',
'datatables.net-bs',
'datatables.net-responsive',
'datatables.net-responsive-bs',
'bootbox',
'moment',
'moment/locale/fr',
'highcharts/highstock',
'highcharts/modules/exporting',
'highcharts/modules/export-data',
'highcharts/modules/no-data-to-display',
'pusher-js',
'laravel-echo',
'vue'
]);
// on compile/minifie la feuille de style pour bootstrap
mix.sass('resources/assets/sass/bootstrap.scss', 'public/css/bs.css');
// on compile/minifie la feuille de style pour le thème admin-lte
mix.less('resources/assets/less/adminlte.less', 'public/css')
.options({
processCssUrls: false,
});
// on compile/minifie notre feuille de style perso
mix.sass('resources/assets/sass/app.scss', 'public/css');
// on active les sourcemaps
mix.sourceMaps();
// on versionne nos images, scripts et feuilles de style
mix.version();
if (!mix.inProduction()) {
mix.browserSync(process.env.APP_URL);
}
My app.js content:
require("./bootstrap");
require("./common");
I know this is due to JS because if I comment out the .extract([...]) and all bootstrap.js content it compiles, but if I have any reference of a library it breaks (for example it breaks if content of bootstrap.js is only window._ = require('lodash');
This is really weird because when I use a fresh new Laravel install, it first works but after any change into webpack.config.js it breaks and rolling it back doesn't help: once it's broken I can't have it working anymore.
I use Homestead on a Windows 10 machine and node and npm versions are (I tried using nvm to solve the problem but unfortunately it doesn't work):
vagrant#homestead:~/laravel_test$ node -v
v9.3.0
vagrant#homestead:~/laravel_test$ npm -v
5.6.0
Any clue on what's going on?
On Windows with vagrant the only solution that works for me is to manually end "NFS server for windows" process from Task Manager and do vagrant reload
For anyone having same problem, after 2 weeks investigation, I finally found the reason: NFS enabled on vagrant Homestead!!! I simply remove the option and it now works.
I am trying to built a MEAN Todo app by following https://github.com/michaelcheng429/super-mean-stack
package.json
{
"name": "ToDoThoughts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "NODE_PATH=$NODE_PATH:./app node server",
"dev": "npm start & webpack-dev-server --progress --colors"
},
"license": "ISC",
"dependencies": {
"angular": "1.4.12",
"angular-ui-router": "0.3.1",
"body-parser": "1.15.2",
"bootstrap": "3.3.7",
"express": "4.14.0"
},
"devDependencies": {
"babel-core": "6.17.0",
"babel-preset-es2015": "6.16.0",
"raw-loader": "0.5.1",
"webpack": "1.13.2",
"webpack-dev-server": "1.16.2"
},
"engines": {
"node": "5.5.0"
}
}
I am getting error when i run the command "npm run dev" in the command prompt.
I have also attached npm.debug.log
> ToDoThoughts#1.0.0 start C:\Projects\ToDoThoughts
> NODE_PATH=$NODE_PATH:./app node server
'NODE_PATH' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Selva\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.5.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! ToDoThoughts#1.0.0 start: `NODE_PATH=$NODE_PATH:./app node server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ToDoThoughts#1.0.0 start script 'NODE_PATH=$NODE_PATH:./app node server'.
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 ToDoThoughts package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_PATH=$NODE_PATH:./app node server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ToDoThoughts
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ToDoThoughts
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Projects\ToDoThoughts\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:\\Users\\Selva\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#3.10.8
3 info using node#v6.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ToDoThoughts#1.0.0~prestart: ToDoThoughts#1.0.0
6 silly lifecycle ToDoThoughts#1.0.0~prestart: no script for prestart, continuing
7 info lifecycle ToDoThoughts#1.0.0~start: ToDoThoughts#1.0.0
8 verbose lifecycle ToDoThoughts#1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle ToDoThoughts#1.0.0~start: PATH: C:\Users\Selva\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Projects\ToDoThoughts\node_modules\.bin;C:\Users\Selva\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Projects\ToDoThoughts\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\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\Selva\AppData\Local\Microsoft\WindowsApps;C:\Users\Selva\AppData\Roaming\npm;C:\Users\Selva\AppData\Local\atom\bin;C:\Program Files\Git\bin;C:\Projects\ToDoThoughts
10 verbose lifecycle ToDoThoughts#1.0.0~start: CWD: C:\Projects\ToDoThoughts
11 silly lifecycle ToDoThoughts#1.0.0~start: Args: [ '/d /s /c', 'NODE_PATH=$NODE_PATH:./app node server' ]
12 silly lifecycle ToDoThoughts#1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle ToDoThoughts#1.0.0~start: Failed to exec start script
14 verbose stack Error: ToDoThoughts#1.0.0 start: `NODE_PATH=$NODE_PATH:./app node server`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Users\Selva\AppData\Roaming\npm\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:\Users\Selva\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid ToDoThoughts#1.0.0
16 verbose cwd C:\Projects\ToDoThoughts
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Selva\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v6.5.0
20 error npm v3.10.8
21 error code ELIFECYCLE
22 error ToDoThoughts#1.0.0 start: `NODE_PATH=$NODE_PATH:./app node server`
22 error Exit status 1
23 error Failed at the ToDoThoughts#1.0.0 start script 'NODE_PATH=$NODE_PATH:./app node server'.
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 ToDoThoughts package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error NODE_PATH=$NODE_PATH:./app node server
23 error You can get information on how to open an issue for this project with:
23 error npm bugs ToDoThoughts
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls ToDoThoughts
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
NPM scripts are executed in the shell from which NPM was invoked.
NODE_PATH=$NODE_PATH:./app node server will not behave correctly if you're using the command prompt or Powershell on Windows. If you already have Git installed, then you should use Git Bash which should already be available.
Otherwise, you might install the MSYS' or Cygwin's Bash shell.
Node on installation should be installed in your systems environment variables and should be called using node in PowerShell or cmd.
This should mean there's no need to always insert the node path in your environment variables.
Make sure you're running PowerShell or cmd as administrator as well, this ensure system environment variables are being picked up.
Lastly, in your package.json change to:
"scripts": {
"start": "node server.js",
"dev": "start cmd /k \"webpack-dev-server --progress --colors\" & node server.js"
}
then run npm start and your server should be running.
"scripts": {
"start": "node server.js",
"dev": "start cmd /k \"webpack-dev-server --progress --colors\" & node server.js"
}
npm cache clean
Then clear package-lock.json file