Why I cannot run npm run dev on a centos7? - javascript

I have a problem installing my app on a new server, I come from centos6 to centos7.
When I am installing a Laravel app that works perfectly on centos6 it goes right except when I run npm run dev
[root#v6-a10 worknow4.0]# npm run dev
> 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
node:events:306
throw er; // Unhandled 'error' event
^
Error: spawn node_modules/webpack/bin/webpack.js EACCES
at Process.ChildProcess._handle.onexit (node:internal/child_process:269:19)
at onErrorNT (node:internal/child_process:467:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
at onErrorNT (node:internal/child_process:467:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -13,
code: 'EACCES',
syscall: 'spawn node_modules/webpack/bin/webpack.js',
path: 'node_modules/webpack/bin/webpack.js',
spawnargs: [
'--progress',
'--hide-modules',
'--config=node_modules/laravel-mix/setup/webpack.config.js'
]
}
npm ERR! code 1
npm ERR! path /home/admin/domains/worknow-cursos.com/public_html/worknow4.0
npm ERR! command failed
npm ERR! command sh -c 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! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-07T19_56_43_919Z-debug.log
npm ERR! code 1
npm ERR! path /home/admin/domains/worknow-cursos.com/public_html/worknow4.0
npm ERR! command failed
npm ERR! command sh -c npm run development
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-07T19_56_44_006Z-debug.log
I have been searching for an answer for hours but nothing works.
I tried to delete node_modules and package-lock and reinstall, but also didn't work.

Ok the problem might be permission as dimitri says. I just go to node_modules/webpack/bin/webpack.js and change the permission to 777
I dont know if this is recomended but at least works

Related

Cant run npm script, it shown "Error: spawn node_modules/webpack/bin/webpack.js EACCES"

I am trying to run my project on Linux Mint that I just installed and configured but when I run the npm run dev command. "spawn node_modules / webpack / bin / webpack.js EACCES" error appears.
I have tried all the methods provided on the internet such as reinstalling nodes, upgrading versions, clear cache nodes and deleting folders. but still error.
> # dev /home/wirnat/Web/Bukasewa/bukasewa.vBETA
> node 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
events.js:187
throw er; // Unhandled 'error' event
^
Error: spawn node_modules/webpack/bin/webpack.js EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'EACCES',
code: 'EACCES',
syscall: 'spawn node_modules/webpack/bin/webpack.js',
path: 'node_modules/webpack/bin/webpack.js',
spawnargs: [
'--progress',
'--hide-modules',
'--config=node_modules/laravel-mix/setup/webpack.config.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `node 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`
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/wirnat/.npm/_logs/2019-10-17T12_37_01_854Z-debug.log
"maybe this problem has to do with permission, but I'm just learning linux and don't really understand it."
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
I just followed above steps and it worked.
I faced the same problem today. Here is my solution
Check your permissions if the node_modules folder is executable by running ls -la (760 is recomended). If thing seems to be okay then try deleting the node_modules folder and install all the modules again by running npm install then run the command npm run development or production depending on your deployment environment

Can not import reactjs

I'm trying to import react, I wrote the following code:
import React from "react";
but when I write npm start in the terminal it shows me these errors:
> reactjs-basics#1.0.0 start /home/zx-coder/Downloads/reactjs-basics-master
> npm run build
> reactjs-basics#1.0.0 build /home/zx-coder/Downloads/reactjs-basics-master
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot
Hash: 2692c371e3a85309b95e Version: webpack 1.15.0 Time: 1020ms
Asset Size Chunks Chunk Names
bundle.js 166 kB 0 [emitted] main bundle.js.map 184 kB 0 [emitted] main
+ 37 hidden modules events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8080
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
"/usr/bin/npm" "run" "build" npm ERR! node v8.10.0 npm ERR! npm
v3.5.2 npm ERR! code ELIFECYCLE npm ERR! reactjs-basics#1.0.0 build:
`webpack -d &&cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the reactjs-basics#1.0.0 build script 'webpack -d
&& cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --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 reactjs-basics package, npm ERR! not
with npm itself. npm ERR! Tell the author that this fails on your
system: npm ERR! webpack -d && cp src/index.html dist/index.html
&& webpack-dev-server --content-base src/ --inline --hot npm ERR! You
can get information on how to open an issue for this project with: npm
ERR! npm bugs reactjs-basics npm ERR! Or if that isn't available,
you can get their info via: npm ERR! npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with anysupport request:
npm ERR!
/home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log
npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
"/usr/bin/npm" "start" npm ERR! node v8.10.0 npm ERR! npm v3.5.2 npm
ERR! code ELIFECYCLE npm ERR! reactjs-basics#1.0.0 start: `npm run
build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
reactjs-basics#1.0.0 start script 'npm run build'. npm ERR! Make sure
you have the latest version of node.js and npm installed. npm ERR! If
you do, this is most likely a problem with the reactjs-basics package,
npm ERR! not with npm itself. npm ERR! Tell the author that this fails
on your system: npm ERR! npm run build npm ERR! You can get
information on how to open an issue for this project with: npm ERR!
npm bugs reactjs-basics npm ERR! Or if that isn't available, you can
get their info via: npm ERR! npm owner ls reactjs-basics npm ERR!
There is likely additional logging output above.
npm ERR! Please include the following file with anysupport request:
npm ERR!
/home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log
The error is Error: listen EADDRINUSE 127.0.0.1:8080 which means there already is something that uses port 8080 on your machine, try changing the port webpack starts the dev server
solution 1: if your are beginner - just restart your PC.
solution 2: open task manager and kill all node instances.
alternatively you check if there is some other react app already running on port 8080 so you have to stop it
OR
you have to change your current app port to some other port.

NPM scripts permission denied on chronos (chromebook shell)

I recently installed node on my chromebook. I have git cloned a basic node repo that is trying to run things like webpack, babel-node, and concurrently through npm scripts.
However, running webpack (in the same directory) works just fine.
I have run "sudo chmod -R 777 my_app" and it did not help.
Here is the error message:
chronos#localhost ~/Downloads/MODULE $ npm start
> my-glitch-app#0.0.1 start /home/chronos/user/Downloads/MODULE
> concurrently "webpack -w -p" "babel-node server.js"
sh: concurrently: Permission denied
npm ERR! Linux 3.18.0-14875-g438cb8ab27c6
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-glitch-app#0.0.1 start: `concurrently "webpack -w -p" "babel-node server.js"`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the my-glitch-app#0.0.1 start script 'concurrently "webpack -w -p" "babel-node server.js"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-glitch-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently "webpack -w -p" "babel-node server.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-glitch-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-glitch-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/chronos/user/Downloads/MODULE/npm-debug.log
following my comment above, sudo mount -o remount,exec /home/chronos/user seemed to work, but i have further anomalies in my case, so i'd be curious about peer experience

Getting error laravel 5.4 vue js setup?

I run the command npm install.
After that running command npm run watch but giving following error in Ubuntu 16.04 terminal.
> # dev /var/www/html/lara-vue
> npm run development
> # development /var/www/html/lara-vue
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
/var/www/html/lara-vue/node_modules/laravel-mix/setup/webpack.config.js:1 (function (exports, require, module, __filename, __dirname) { let path
= require('path');
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at requireConfig (/var/www/html/lara-vue/node_modules/webpack/bin/convert-argv.js:96:18)
at /var/www/html/lara-vue/node_modules/webpack/bin/convert-argv.js:109:17
at Array.forEach (native)
npm ERR! Linux 4.8.0-58-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "development" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE 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 '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! 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 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 node_modules/webpack/bin/webpack.js --progress --hide-modules
--config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls 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/lara-vue/npm-debug.log
npm ERR! Linux 4.8.0-58-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE npm ERR! # dev: `npm run development` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the # dev script 'npm run development'. 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 package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run development npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls 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/lara-vue/npm-debug.log

Error in "npm start" command of angular seed cloning

I am getting the below error when i clone the angular seed from github and run the node server. I have cloned the angular seed to the existing project directory. I am not sure what is going wrong. But i am getting the below error. Kindly help
$ npm start
> StickyTodos#0.0.0 prestart C:\projects\StickyTodos
> npm install
> StickyTodos#0.0.0 postinstall C:\projects\StickyTodos
> bower install
> StickyTodos#0.0.0 start C:\projects\StickyTodos
> http-server -a localhost -p 8000 -c-1
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8000
at Object.exports._errnoException (util.js:860:11)
at exports._exceptionWithHostPort (util.js:883:20)
at Server._listen2 (net.js:1234:14)
at listen (net.js:1270:10)
at net.js:1379:9
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v5.0.0
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! StickyTodos#0.0.0 start: `http-server -a localhost -p 8000 -c-1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the StickyTodos#0.0.0 start script 'http-server -a localhost -p 8000 -c-1'.
npm ERR! This is most likely a problem with the StickyTodos package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! http-server -a localhost -p 8000 -c-1
npm ERR! You can get their info via:
npm ERR! npm owner ls StickyTodos
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\projects\StickyTodos\npm-debug.log
The error Error: listen EADDRINUSE 127.0.0.1:8000 is explaining that something is already bound to port 8000.
As you are on Windows, running netstat -a -b in an elevated command prompt (Right click start button and press Command Prompt (Admin)) should show you what is already listening to port 8000.
Simply stop that process, or alternatively bind to a different port which is free.

Categories

Resources