Node.js npm run dev throws missing module error - node.js

I'm running ubuntu on Virtual Machine on a windows computer; I have node.js and npm installed globally (node version 10.6.0; npm version 6.4.1). I cloned a React app from our internal bitbucket repo, checked out to a branch and created a new branch from that; the app is supposed to run by 'npm run dev' but when I try to run it, I get the following error:
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'braces'
When I install module 'braces', and try 'npm run dev' it gives missing module of some other module and so on. I was told by one of the developers that I need to be running npm locally and not globally (which is how I have it in my case); I tried uninstalling node.js and npm but the system won't uninstall it. Do i need to do the uninstall from root (by doing sudo -i, going to root and uninstalling)? Also, I need node.js version 10.6.0 and npm version 6.4.1 which is needed to run my other node.js/graphQL APIs - how do I make sure that I install those exact versions, after uninstalling node.js and npm from root?
Following is debug info from debug log:
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev'
]
2 info using npm#6.4.1
3 info using node#v10.6.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle abcms#1.0.2~predev: abcms#1.0.2
6 info lifecycle abcms#1.0.2~dev: abcms#1.0.2
7 verbose lifecycle abcms#1.0.2~dev: unsafe-perm in lifecycle true
8 verbose lifecycle abcms#1.0.2~dev: PATH:
/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-
bin:/home/usname123/Documents/DEV/uppperFolder/
abcms/node_modules/.bin:/home/rv7
94a/bin:/usr/local/bin:/usr/bin:/usr/bin/js:/home/usname123/.local/
bin:/home/usn
ame123/bin:/home/usname123/.local/bin:/var/opt/SoapUI-
5.2.1/bin:/var/opt/java/jdk1.8.0_77/bin:/usr/
local/sbin:/usr/local/bin:/usr/sbin
:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle abcms#1.0.2~dev: CWD:
/home/rv794a/Documents/DEV/upperFolder/abcms
10 silly lifecycle abcms#1.0.2~dev: Args:
[ '-c', 'webpack-dev-server --
mode development --open' ]
11 silly lifecycle abcms#1.0.2~dev: Returned: code: 1 signal: null
12 info lifecycle abcms#1.0.2~dev: Failed to exec dev script
13 verbose stack Error: abcms#1.0.2 dev: `webpack-dev-server --mode
development --open`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous>
(/usr/local/lib/node_modules/npm/node_modules/npm-
lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js: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:248:5)
14 verbose pkgid abcms#1.0.2
15 verbose cwd /home/usname123/Documents/DEV/upperFolder/abcms
16 verbose Linux 4.4.0-159-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v10.6.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error abcms#1.0.2 dev: `webpack-dev-server --mode development --open`
22 error Exit status 1
23 error Failed at the abcms#1.0.2 dev script.
23 error This is probably not a problem with npm. There is likely
additional logging output above.
24 verbose exit [ 1, true ]

Related

Plesk npm 12 installed, but showing 6.9.0

I have installed Node.js from upgrade/install packages without any problems, but when I try to run the following: /opt/plesk/node/12/bin/node -v the output i get is:
12.4.0
The problem is that when I try to install authentication with Bootstrap for Laravel, and I get to the point where I need to run: npm install && npm run dev I get the following error when running /opt/plesk/node/12/bin/npm run dev:
Error: You are using an unspported version of Node. Please update to
at least Node v12.14
It seems like I a'm running the newest version, but it still complaints about wrong version number? - How to fix?
UPDATE (debug log):
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/opt/plesk/node/12/bin/node',
1 verbose cli '/opt/plesk/node/12/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.9.0
3 info using node#v12.4.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: /opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/vhosts/domain.com/httpdocs2/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/us$
9 verbose lifecycle #~dev: CWD: /var/www/vhosts/domain.com/httpdocs2
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> (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:200:13)
13 verbose stack at ChildProcess.<anonymous> (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:200:13)
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 #
15 verbose cwd /var/www/vhosts/domain.com/httpdocs2
16 verbose Linux 4.15.0-126-generic
17 verbose argv "/opt/plesk/node/12/bin/node" "/opt/plesk/node/12/bin/npm" "run" "dev"
18 verbose node v12.4.0
19 verbose npm v6.9.0
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 ]
A big thanks to NullDev for leading me in the right direction!
I found the answer here: How to add a new node.js version for the Node.js Manager on Plesk?
We need to install Node Version Manager
Then install whatever version we want (I wanted the newest one v14.15.4)
We then copy that version to Plesk default Node versions path
And finally we tell Plesk about the newly version created
Then in the list of all versions installed, we refresh and voila, we now have support for v14.15.4
Credit for this goes to Maertz

sh: 1: rimraf: Permission denied issue on live server

Thanks for looking at my issue.
Basically I am facing problem with making build on production dedicated server.
I have executed "npm run build" command and I have received the
the issue
sh: 1: rimraf: Permission denied issue on live server
I am not sure how exactly we should solve it.
My error logs are as follow below.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm#6.10.2
3 info using node#v9.11.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle #~prebuild: #
6 info lifecycle #~build: #
7 verbose lifecycle #~build: unsafe-perm in lifecycle true
8 verbose lifecycle #~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/html/basepath/moneytransfer/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle #~build: CWD: /var/www/html/basepath/moneytransfer
10 silly lifecycle #~build: Args: [ '-c',
10 silly lifecycle 'npm run clean && webpack --mode development --progress' ]
11 silly lifecycle #~build: Returned: code: 126 signal: null
12 info lifecycle #~build: Failed to exec build script
13 verbose stack Error: # build: `npm run clean && webpack --mode development --progress`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack at EventEmitter.emit (events.js:180:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:180:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid #
15 verbose cwd /var/www/html/basepath/moneytransfer
16 verbose Linux 4.15.0-29-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v9.11.2
19 verbose npm v6.10.2
20 error code ELIFECYCLE
21 error errno 126
22 error # build: `npm run clean && webpack --mode development --progress`
22 error Exit status 126
23 error Failed at the # build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
npm i rimraf
worked for me because I was not in wifi environment. I had a similar error trace (after porting a project with node_modules from windows to mac)
I tried so many solution but nothing worked.But finally removed node_modules folder and executed "npm install" which means re-installation of node modules.And Everything seems working fine now.
Deleting the node_modules folder seemed to do the trick whenever I was running into such problems!
It is probably caused by different rules related to different file systems; e.g. just different systems or even different operating systems.

npm run dev command gives error log and it doesn't open my project in browser

When i run my react node project in my ubuntu system with command npm run dev, It gives me error log and it doesn't opening in my browser, even when i try to open it with localhost:3000 it doesn't working, here is my error log, can anyone please look in it and give me proper solution ?
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'client' ]
2 info using npm#3.5.2
3 info using node#v8.10.0
4 verbose run-script [ 'preclient', 'client', 'postclient' ]
5 info lifecycle mern-auth#1.0.0~preclient: mern-auth#1.0.0
6 silly lifecycle mern-auth#1.0.0~preclient: no script for preclient, continuing
7 info lifecycle mern-auth#1.0.0~client: mern-auth#1.0.0
8 verbose lifecycle mern-auth#1.0.0~client: unsafe-perm in lifecycle true
9 verbose lifecycle mern-auth#1.0.0~client: PATH: /usr/share/npm/bin/node-gyp-bin:/var/www/mern-plaid/node_modules/.bin:/usr/share/npm/bin/node-gyp-bin:/var/www/mern-plaid/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle mern-auth#1.0.0~client: CWD: /var/www/mern-plaid
11 silly lifecycle mern-auth#1.0.0~client: Args: [ '-c', 'npm start --prefix client' ]
12 silly lifecycle mern-auth#1.0.0~client: Returned: code: 1 signal: null
13 info lifecycle mern-auth#1.0.0~client: Failed to exec client script
14 verbose stack Error: mern-auth#1.0.0 client: `npm start --prefix client`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack at emitTwo (events.js:126:13)
14 verbose stack at EventEmitter.emit (events.js:214:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:126:13)
14 verbose stack at ChildProcess.emit (events.js:214:7)
14 verbose stack at maybeClose (internal/child_process.js:925:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid mern-auth#1.0.0
16 verbose cwd /var/www/mern-plaid
17 error Linux 5.0.0-25-generic
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "client"
19 error node v8.10.0
20 error npm v3.5.2
21 error code ELIFECYCLE
22 error mern-auth#1.0.0 client: `npm start --prefix client`
22 error Exit status 1
23 error Failed at the mern-auth#1.0.0 client script 'npm start --prefix client'.
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 mern-auth package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm start --prefix client
23 error You can get information on how to open an issue for this project with:
23 error npm bugs mern-auth
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls mern-auth
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Jhipster build production command with Maven return Error

i try to build to production my jhipster project ( Spring with Angular 7 ) but i receive a lot Errors i add this trace from my log :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Eventim\frontend\node\node.exe',
1 verbose cli 'C:\Eventim\frontend\node\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'webpack:prod:main' ]
2 info using npm#6.4.1
3 info using node#v10.13.0
4 verbose run-script [ 'prewebpack:prod:main',
4 verbose run-script 'webpack:prod:main',
4 verbose run-script 'postwebpack:prod:main' ]
5 info lifecycle frontend#0.0.0prewebpack:prod:main: frontend#0.0.0
6 info lifecycle frontend#0.0.0webpack:prod:main: frontend#0.0.0
7 verbose lifecycle frontend#0.0.0webpack:prod:main: unsafe-perm in lifecycle true
8 verbose lifecycle frontend#0.0.0webpack:prod:main: PATH: C:\Eventim\frontend\node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Eventim\frontend\node_modules.bin;C:\Eventim\frontend\node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Eventim\frontend\node_modules.bin;C:\Eventim\frontend\node;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;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:\Windows\System32\OpenSSH;C:\Program Files\nodejs;C:\Program Files\Java\jdk1.8.0_202\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\Users\Admin\AppData\Roaming\npm;C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Admin\AppData\Local\GitHubDesktop\bin;C:\Users\Admin\AppData\Local\Yarn\bin;
9 verbose lifecycle frontend#0.0.0webpack:prod:main: CWD: C:\Eventim\frontend
10 silly lifecycle frontend#0.0.0webpack:prod:main: Args: [ '/d /s /c',
10 silly lifecycle 'npm run webpack -- --config webpack/webpack.prod.js --profile' ]
11 silly lifecycle frontend#0.0.0webpack:prod:main: Returned: code: 2 signal: null
12 info lifecycle frontend#0.0.0webpack:prod:main: Failed to exec webpack:prod:main script
13 verbose stack Error: frontend#0.0.0 webpack:prod:main: npm run webpack -- --config webpack/webpack.prod.js --profile
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (C:\Eventim\frontend\node\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess. (C:\Eventim\frontend\node\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:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid frontend#0.0.0
15 verbose cwd C:\Eventim\frontend
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\Eventim\frontend\node\node.exe" "C:\Eventim\frontend\node\node_modules\npm\bin\npm-cli.js" "run" "webpack:prod:main"
18 verbose node v10.13.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error frontend#0.0.0 webpack:prod:main: npm run webpack -- --config webpack/webpack.prod.js --profile
22 error Exit status 2
23 error Failed at the frontend#0.0.0 webpack:prod:main script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
Reproduce the error
i try to go to production with maven build war file with this command :
./mvnw -Pprod package
JHipster Version(s)
5.7.0
JHipster configuration
INFO! Using JHipster version installed globally
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
C:\
`-- (empty)
cat: no such file or directory: .yo-rc.json
java version "1.8.0_192"
node: v11.2.0
npm: 6.4.1
yeoman: 2.0.5
yarn: 1.12.3
working on windows 10

ng serve fails on Angular 2 created with angular CLI on BoUoW

I am running BoUoW in elevation mode and have installed #angular/cli and created a sample project using the new command.
When i try to run the app by npm start it fails by stating the error ng serve failed, and blames it on npm and node version issues or the app itself. npm and node version are the latest ones.
Any angular 2 expert advice or am i using the wrong boilerplate app?
Edit:
#angular/cli: 1.0.0-beta.32.3
node: 6.9.5
npm: 3.10.10
Edit 2: (error logs)
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#4.1.2
3 info using node#v7.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle testapp#0.0.0~prestart: testapp#0.0.0
6 silly lifecycle testapp#0.0.0~prestart: no script for prestart, continuing
7 info lifecycle testapp#0.0.0~start: testapp#0.0.0
8 verbose lifecycle testapp#0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle testapp#0.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/mnt/c/Users/sande/Desktop/testapp/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
10 verbose lifecycle testapp#0.0.0~start: CWD: /mnt/c/Users/sande/Desktop/testapp
11 silly lifecycle testapp#0.0.0~start: Args: [ '-c', 'ng serve' ]
12 silly lifecycle testapp#0.0.0~start: Returned: code: 1 signal: null
13 info lifecycle testapp#0.0.0~start: Failed to exec start script
14 verbose stack Error: testapp#0.0.0 start: `ng serve`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:192:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/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:192:7)
14 verbose stack at maybeClose (internal/child_process.js:890:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid testapp#0.0.0
16 verbose cwd /mnt/c/Users/sande/Desktop/testapp
17 error Linux 3.4.0+
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v7.5.0
20 error npm v4.1.2
21 error code ELIFECYCLE
22 error testapp#0.0.0 start: `ng serve`
22 error Exit status 1
23 error Failed at the testapp#0.0.0 start script 'ng serve'.
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 testapp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ng serve
23 error You can get information on how to open an issue for this project with:
23 error npm bugs testapp
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls testapp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Edit 3: Steps to reproduce
Note i am using BoUoW on 14393.693 / 14.04.5 LTS
sudo n v7.5.0
npm install -g #angular/cli
ng new my-project
cd my-project
npm start
You've older version of node and npm. Current versions are:
node - v7.5.0
nam - 4.1.2
Please upgrade and try it again.
By the way, with Angular CLI, you can just ng serve. No need to use npm start.

Resources