Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
2
answers
2088
views
Installing npm on Centos 7
I can say I went through **all Google results regarding this**, but no one works. The GNU libc version is very old: `ldd (GNU libc) 2.17`. Trying version up to `nodesource 8.x` **all installations fails because of the old GNU libc**: Error: Package: 2:nodejs-19.9.0-1nodesource.x86_64 (nodesource) Re...
I can say I went through **all Google results regarding this**, but no one works. The GNU libc version is very old:
ldd (GNU libc) 2.17
.
Trying version up to nodesource 8.x
**all installations fails because of the old GNU libc**:
Error: Package: 2:nodejs-19.9.0-1nodesource.x86_64 (nodesource)
Requires: libm.so.6(GLIBC_2.27)(64bit)
Error: Package: 2:nodejs-19.9.0-1nodesource.x86_64 (nodesource)
Requires: libc.so.6(GLIBC_2.28)(64bit)
What can I do? Would it help when I try to build node from the source with gcc-c++
? Reading the requirements I doubt this will work because Centos 7 has also a very old gcc version which is not supported anymore, or am I wrong?
Any hints?
Peter VARGA
(1082 rep)
Jun 13, 2023, 07:32 PM
• Last activity: Jan 6, 2025, 12:51 PM
1
votes
1
answers
765
views
Make npm work in tails
The latest tails comes with nodejs v10.24.0. Trying to get tails to run a newer node has been unsuccessful even after running script from deb.nodesource.com/setup_14x which said buster was unsupported. I think updating node was a red herring anyway. npm is not included so I use ```sudo apt install n...
The latest tails comes with nodejs v10.24.0. Trying to get tails to run a newer node has been unsuccessful even after running script from deb.nodesource.com/setup_14x which said buster was unsupported. I think updating node was a red herring anyway.
npm is not included so I use
apt install npm
to install npm. I get version 5.8.0. I need npm to install create-react-app and other node tools.
All npm commands return warning
Npm does not support node.js v10.24.0
(hence the red herring to update that)
In persistant storage I create a directory "foo" and cd to foo, I run
init
And then
install
And in addition to the warning above it seems to fail to connect to
registry.npmjs.org:443
with getaddrinfo EAI_AGAIN
Putting that url into the tor browser connects just fine.
My current working theory is that I need to configure npm proxy and npm https-proxy, but for that I seem to require proxy credentials, url, and port. I don't know what those are or how to find them in tails. I am not behind any other proxy besides tor running in Tails.
Question: how to make npm work in tails.
DavesPlanet
(121 rep)
Dec 6, 2021, 03:24 AM
• Last activity: Nov 30, 2024, 09:48 PM
0
votes
1
answers
90
views
Mismatched versions warning when updating Node.js/NPM in Docker
In our `Dockerfile` we have: ``` FROM ghcr.io/puppeteer/puppeteer:latest AS pdf WORKDIR /puppeteer USER root # Prerequisites RUN apt-get update && apt-get install nginx -y # Update RUN npm update RUN npm update -g RUN npm install -g npm # Dependencies RUN npm install puppeteer # Run COPY ./pdf.js ....
In our
Dockerfile
we have:
FROM ghcr.io/puppeteer/puppeteer:latest AS pdf
WORKDIR /puppeteer
USER root
# Prerequisites
RUN apt-get update && apt-get install nginx -y
# Update
RUN npm update
RUN npm update -g
RUN npm install -g npm
# Dependencies
RUN npm install puppeteer
# Run
COPY ./pdf.js .
RUN chmod u+x pdf.js
RUN service nginx start && ./pdf.js
This waits for Nginx to start and then runs a Node.js script (which crawls some pages on the Nginx webserver).
Are the commands correct in # Update
? Does the order of the commands matter, in order for it to update properly and fully?
Node.js/NPM appears to update but throws the following warning in the console whilst it works (it takes some time):
#43 3.167 npm WARN EBADENGINE Unsupported engine {
#43 3.169 npm WARN EBADENGINE package: 'corepack@0.28.0',
#43 3.170 npm WARN EBADENGINE required: { node: '^18.17.1 || >=20.10.0' },
#43 3.172 npm WARN EBADENGINE current: { node: 'v20.9.0', npm: '10.1.0' }
#43 3.174 npm WARN EBADENGINE }
How can we fix this warning about an unsupported engine/mismatched versions? I.E. how can we update from Node v20.9.0
to v20.10.0
(or latest)?
Docker specifically recommend that you should use apt-get update
in their best practices . Should we also be updating Node.js/NPM like the above? Could updating potentially cause any issues for our install of Google Puppeteer ? I.E. because those later versions are untested on puppeteer:latest
by Google.
Danny Beckett
(797 rep)
May 5, 2024, 04:12 PM
• Last activity: May 6, 2024, 05:25 AM
0
votes
1
answers
219
views
How can I start a NPM app from a desktop shortcut?
I have created a desktop shortcut for a `npm` application called TMXEditor, but it doesn't work. I can launch the app if I do `cd /home/souto/Apps/maxprograms/TMXEditor && npm start` on a terminal. I put that in a bash file `/home/souto/Apps/maxprograms/TMXEditor/start.sh`. The application runs if I...
I have created a desktop shortcut for a
npm
application called TMXEditor, but it doesn't work.
I can launch the app if I do cd /home/souto/Apps/maxprograms/TMXEditor && npm start
on a terminal.
I put that in a bash file /home/souto/Apps/maxprograms/TMXEditor/start.sh
. The application runs if I just run that script in a terminal. Its exact contents are:
#!/bin/bash
cd /home/souto/Apps/maxprograms/TMXEditor && npm start
So I have created the .desktop file pointing to that:
[Desktop Entry]
Name=TMXEditor
Exec=/home/souto/Apps/maxprograms/TMXEditor/start.sh
Icon=/home/souto/Apps/maxprograms/TMXEditor/icons/tmxeditor.png
StartupNotify=true
Terminal=false
Type=Application
Categories=Translation;
Comment=
Path=/home/souto/Apps/maxprograms/TMXEditor
The .desktop
file is saved as /home/souto/.local/share/applications/TMXEditor.desktop
.
I can see the shortcut in Rofi, but when I run it from there the application will not start.
I have also tried putting Exec=xfce4-terminal -e "/home/souto/Apps/maxprograms/TMXEditor/start.sh
. In that case, I can see a terminal blinking for a fraction of a second but still the application will not run.
Both the .desktop and the bash files are executable:
-rwxrwxr-x 1 souto souto 296 feb 19 14:27 /home/souto/.local/share/applications/TMXEditor.desktop
-rwxrwxrwx 1 souto souto 67 feb 19 13:53 /home/souto/Apps/maxprograms/TMXEditor/start.sh
My desktop environment is Xfce 4.18 (on arch linux) and I normally use zsh 5.9 as the shell.
I'd appreciate some help to debug this shorcut. Thanks.
msoutopico
(103 rep)
Feb 19, 2024, 01:39 PM
• Last activity: Feb 20, 2024, 06:52 PM
0
votes
0
answers
35
views
I think nodejs broke Linux Mint after it was about 50% done with updating: E: Sub-process /usr/bin/dpkg returned an error code (1)
So there's a lot here probably best explained by copy-pasting what happened on the terminal but the problem is I currently cannot open any windows that are already minimized, except Discord since it has an extra button on the bottom panel. This includes the terminal everything happened on. Things ar...
So there's a lot here probably best explained by copy-pasting what happened on the terminal but the problem is I currently cannot open any windows that are already minimized, except Discord since it has an extra button on the bottom panel. This includes the terminal everything happened on. Things are not good! Luckily, though, I already copy-pasted and searched SOME exact text from the terminal, and still have those searches open, so I will copy those here. I will try to explain anything else as best as I can, but Im still relatively new to Linux so it probably wont be the most thorough.
Basically Ive been trying to completely uninstall nodejs, nvm and npm from my system, theyre not working for me. However, now whenever I try to install something from the terminal with
apt
, I get this message:
nodejs : Depends: libnode72 (= 12.22.9~dfsg-1ubuntu3.1) but 12.22.9~dfsg-1ubuntu3.2 is to be installed
This is despite the fact Im pretty sure I followed the exact instructions of the second answer in https://stackoverflow.com/questions/32426601/how-can-i-completely-uninstall-nodejs-npm-and-node-in-ubuntu
(I know because I tried to rm -rf everything he said, but none of it was even there, so I must've done so a while ago. HOWEVER, I may not have gone to /etc/apt/sources.list.d
and deleted all my node lists there, as the first guy said. This may be part of the problem. Im pretty sure my .nvm
, .npm
and .node
home folders are all gone.)
Whenever I try to install nodejs, as I believe it suggests right after that line, I get a whole list of dozens of node programs (I remember a "node-abab" for example?) that need *something* installed, I cant remember, but it may have, ironically, been nodejs which I was... trying to install.
Now having used which node
, which nodejs
, which npm
and which nvm
, as suggested by the first answer in the thread I linked, to find bin/node
and bin/nodejs
(if I remember correctly, one of them may have been bin/npm
or bin/nvm
instead, but I think it was node and nodejs) I deleted those too.
Only after this did I decide to actually look up the error message itself to find this answer: https://askubuntu.com/questions/1362719/error-upgrading-nodejs
I was able to do every step without fail until sudo apt dist-upgrade
. I believe at around 8% or 13% my entire screen started flickering, it went between fine, to all black, to all black except the terminal, to all black except the terminal and Linux, back and forth until it got to I believe around 50% and I got this error message:
Errors were encountered while processing:
/tmp/apt-dpkg-install-EgLtvN/48-libnode-dev_12.22.9~dfsg-1ubuntu3.3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Now the bottom panel is broken- I can open the app list with the Windows key on my keyboard, I can open a new terminal with a keyboard shortcut but I cannot open any minimized windows. All windows and the app list dont display their images on the panel, only a thin strip below them if theyre open and the number of windows each app has open. Of the buttons to the side of the list of apps, only Discord, the time, the "show the desktop" button, and a lone 9 display. I am afraid to minimize anything, as I minimized the terminal I input all this on and now I cant open it again, only new terminal with a new keyboard shortcut as I said before.
Some extra info, it's at all helpful: Firefox was updated and was able to restart and apply the updates with no issues, opening back up after restarting and everything. Another weird thing that happened after uninstalling bin/node
and bin/nodejs
is, when searching something on DuckDuckGo, the magnifying glass button in the search bar is replaced with a captial "S." The button to delete your search was also replaced with a capital "X." (Though, it looks kinda familiar, it may have happened before for unrelated reasons, and I only noticed it now because I was nervous something wrong was gonna happen.) I havent noticed any glitches on any other websites.
Also, I dont think I have snap on my desktop at all, and I dont have anything downloaded via snap. I know this is a bit of a non-sequitor but it seems to come up a lot in anything revolving around problems installing nodejs so I thought I'd mention it.
According to my new terminal window, my version is Linux Mint 21.2. Please help!
itsnotworkingandimscared
(1 rep)
Jan 10, 2024, 03:36 AM
-1
votes
1
answers
493
views
Why Ubuntu does not see npm? sudo: npm: command not found
I run sudo npm install -g @angular/cli got sudo: npm: command not found Let's check nvm install v20.0.0 v20.0.0 is already installed. Now using node v20.0.0 (npm v9.6.4) and which npm /home/miki/.nvm/versions/node/v20.0.0/bin/npm why it seems that npm is not installed? I am on Ubunutu 22.04.
I run
sudo npm install -g @angular/cli
got
sudo: npm: command not found
Let's check
nvm install v20.0.0
v20.0.0 is already installed.
Now using node v20.0.0 (npm v9.6.4)
and
which npm
/home/miki/.nvm/versions/node/v20.0.0/bin/npm
why it seems that npm is not installed? I am on Ubunutu 22.04.
MikiBelavista
(1755 rep)
Dec 27, 2023, 09:24 AM
• Last activity: Dec 27, 2023, 11:52 AM
2
votes
1
answers
2007
views
Building an image with buildah I'm getting: EMFILE: too many open files
When I run `buildah bud`, I'm getting the following error. ```text npm ERR! code EMFILE npm ERR! syscall open npm ERR! path /root/.npm/_cacache/index-v5/cd/a5/aca06eccd914d83e3be09412f45e00ceac1150a83df0e32d015284f4c8f6 npm ERR! errno -24 npm ERR! EMFILE: too many open files, open '/root/.npm/_cacac...
When I run
buildah bud
, I'm getting the following error.
npm ERR! code EMFILE
npm ERR! syscall open
npm ERR! path /root/.npm/_cacache/index-v5/cd/a5/aca06eccd914d83e3be09412f45e00ceac1150a83df0e32d015284f4c8f6
npm ERR! errno -24
npm ERR! EMFILE: too many open files, open '/root/.npm/_cacache/index-v5/cd/a5/aca06eccd914d83e3be09412f45e00ceac1150a83df0e32d015284f4c8f6'
How can I resolve this problem?
Evan Carroll
(34663 rep)
Feb 22, 2023, 08:19 PM
• Last activity: Oct 18, 2023, 04:09 PM
2
votes
2
answers
4853
views
wscat is broken on install
wscat broken - any ideas why - I use this tool a lot, never seen this before. Ubuntu 20.04 ``` # npm install -g wscat added 9 packages in 2s root@simp:~# wscat node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module 'debug' Require stack: - /usr/lib/x86_64-linux-gnu/nodejs/ws/nod...
wscat broken - any ideas why - I use this tool a lot, never seen this before.
Ubuntu 20.04
# npm install -g wscat
added 9 packages in 2s
root@simp:~# wscat
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module 'debug'
Require stack:
- /usr/lib/x86_64-linux-gnu/nodejs/ws/node_modules/https-proxy-agent/index.js
- /usr/lib/x86_64-linux-gnu/nodejs/wscat/bin/wscat
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/usr/lib/x86_64-linux-gnu/nodejs/ws/node_modules/https-proxy-agent/index.js:11:13)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/lib/x86_64-linux-gnu/nodejs/ws/node_modules/https-proxy-agent/index.js',
'/usr/lib/x86_64-linux-gnu/nodejs/wscat/bin/wscat'
]
}
guesty
(189 rep)
Jan 2, 2023, 08:46 PM
• Last activity: Sep 27, 2023, 01:08 PM
28
votes
3
answers
32276
views
How to install npm packages in NixOS?
In NixOS, I installed the package `yarn` as usual by running `$ nix-env -i yarn`. Now I am attempting to run `yarn` via `$ yarn start`. But this leads me to the following error. $ yarn start yarn start v0.20.3 $ webpack-dev-server --env dev sh: webpack-dev-server: command not found error Command fai...
In NixOS, I installed the package
yarn
as usual by running $ nix-env -i yarn
. Now I am attempting to run yarn
via $ yarn start
. But this leads me to the following error.
$ yarn start
yarn start v0.20.3
$ webpack-dev-server --env dev
sh: webpack-dev-server: command not found
error Command failed with exit code 127.
When I try to install webpack-dev-server
in my usual NixOS way I get a 'matches no derivations' error.
$ nix-env -i webpack-dev-server
error: selector ‘webpack-dev-server’ matches no derivations
I read that webpack-dev-server
is an npm package, and am unsure of a couple questions regarding the relevance of that in this case.
1. Does it make sense to use npm, a different package manager than nix,
under Nix?
2. If answer to (1) is yes, then how to install npm on NixOS? I do not
see npm available when searching via nix-env
, as $ nix-env -qa npm
also matches no derivations.
**What is the correct way to install webpack-dev-server
on NixOS?**
------------------------------------
EDIT
I attempted to install webpack-dev-server
following the commented link and was able to install node2nix
, but am not able to follow through on step 2 listed in the readme there.
I located the file referenced in step 2 in /nix/store
at
/nix/store/sgk7sxgqxrv2axkxjwc3y15apcqbrv1z-nixos-17.03.1482.1b57bf274a/nixos/pkgs/development/node-packages/node-packages.json
I can open that file to view the npm packages listed, but the permissions are read-only, even running with sudo -- so I would need to edit it's permissions in order to alter it.
It seems that I should not be editing this /nix/store
file directly and should instead be manipulating it indirectly via nix. **Am I correct that I should not be editing this file directly?** If so, **how else can I complete step 2 by using nix or something to add webpack-dev-server
to it?**
mherzl
(1629 rep)
Jul 20, 2017, 10:19 PM
• Last activity: Jul 31, 2023, 03:31 PM
1
votes
1
answers
282
views
OpenBSD: npm install sodium-native, interpret error messages
I am attempting to install [sodium native][1] as an npm package on OpenBSD 7.3 amd64. *Aside: As a dependency of [Hypercore, Hyperbee and Corestore][2].* This needs [node-gyp][3]. Following [this][4], I set the C and C++ compilers to clang: export CC=clang export CXX=clang++ I created a directory `e...
I am attempting to install sodium native as an npm package on OpenBSD 7.3 amd64.
*Aside: As a dependency of Hypercore, Hyperbee and Corestore .*
This needs node-gyp .
Following this , I set the C and C++ compilers to clang:
export CC=clang
export CXX=clang++
I created a directory
example
and, for development/debugging only, I set the permissions via chmod 777
.
I then used npm init
to create an empty package.json
file.
On running npm install sodium-native
, I get the following error logs:
395 info run sodium-native@4.0.1 install node_modules/sodium-native node-gyp-build
396 info run sodium-native@4.0.1 install { code: 1, signal: null }
397 timing reify:rollback:createSparse Completed in 4183ms
398 timing reify:rollback:retireShallow Completed in 0ms
399 timing command:install Completed in 31258ms
400 verbose stack Error: command failed
400 verbose stack at ChildProcess. (/usr/local/lib/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
400 verbose stack at ChildProcess.emit (node:events:513:28)
400 verbose stack at maybeClose (node:internal/child_process:1091:16)
400 verbose stack at Socket. (node:internal/child_process:449:11)
400 verbose stack at Socket.emit (node:events:513:28)
400 verbose stack at Pipe. (node:net:322:12)
401 verbose pkgid sodium-native@4.0.1
402 verbose cwd /example
403 verbose OpenBSD 7.3
404 verbose node v18.15.0
405 verbose npm v9.5.0
406 error code 1
407 error path /example/node_modules/sodium-native
408 error command failed
409 error command sh -c node-gyp-build
410 error gyp info it worked if it ends with ok
410 error gyp info using node-gyp@9.3.1
410 error gyp info using node@18.15.0 | openbsd | x64
410 error gyp info find Python using Python version 3.10.11 found at "/usr/local/bin/python3"
410 error gyp info spawn /usr/local/bin/python3
410 error gyp info spawn args [
410 error gyp info spawn args '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
410 error gyp info spawn args 'binding.gyp',
410 error gyp info spawn args '-f',
410 error gyp info spawn args 'make',
410 error gyp info spawn args '-I',
410 error gyp info spawn args '/example/node_modules/sodium-native/build/config.gypi',
410 error gyp info spawn args '-I',
410 error gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
410 error gyp info spawn args '-I',
410 error gyp info spawn args '/root/.cache/node-gyp/18.15.0/include/node/common.gypi',
410 error gyp info spawn args '-Dlibrary=shared_library',
410 error gyp info spawn args '-Dvisibility=default',
410 error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.15.0',
410 error gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
410 error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.15.0/<(target_arch)/node.lib',
410 error gyp info spawn args '-Dmodule_root_dir=/example/node_modules/sodium-native',
410 error gyp info spawn args '-Dnode_engine=v8',
410 error gyp info spawn args '--depth=.',
410 error gyp info spawn args '--no-parallel',
410 error gyp info spawn args '--generator-output',
410 error gyp info spawn args 'build',
410 error gyp info spawn args '-Goutput_dir=.'
410 error gyp info spawn args ]
410 error node:events:491
410 error throw er; // Unhandled 'error' event
410 error ^
410 error
410 error Error: write EPIPE
410 error at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
410 error Emitted 'error' event on Socket instance at:
410 error at Socket.onerror (node:internal/streams/readable:785:14)
410 error at Socket.emit (node:events:513:28)
410 error at emitErrorNT (node:internal/streams/destroy:151:8)
410 error at emitErrorCloseNT (node:internal/streams/destroy:116:3)
410 error at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
410 error errno: -32,
410 error code: 'EPIPE',
410 error syscall: 'write'
410 error }
410 error
410 error Node.js v18.15.0
410 error gyp: Call to 'node deps/bin.js --print-include' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
410 error gyp ERR! configure error
410 error gyp ERR! stack Error: gyp
failed with exit code: 1
410 error gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:325:16)
410 error gyp ERR! stack at ChildProcess.emit (node:events:513:28)
410 error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
410 error gyp ERR! System OpenBSD 7.3
410 error gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
410 error gyp ERR! cwd /example/node_modules/sodium-native
410 error gyp ERR! node -v v18.15.0
410 error gyp ERR! node-gyp -v v9.3.1
410 error gyp ERR! not ok
411 verbose exit 1
412 timing npm Completed in 31440ms
413 verbose unfinished npm timer reify 1683196282136
414 verbose unfinished npm timer reify:build 1683196305333
415 verbose unfinished npm timer build 1683196305334
416 verbose unfinished npm timer build:deps 1683196305334
417 verbose unfinished npm timer build:run:install 1683196305349
418 verbose unfinished npm timer build:run:install:node_modules/sodium-native 1683196307572
419 verbose code 1
420 error A complete log of this run can be found in:
420 error /root/.npm/_logs/2023-05-04T10_31_22_018Z-debug-0.log
The node_modules directory did not get created. I am unsure how to interpret this. It's not clear to me whether its a permissions problem, a compiler toolchain problem, or something else.
What might be going wrong here? What next steps could I take?
---
**EDIT:** Further investigation :
The problem can be more directly recreated like so:
pkg_add git
git clone --branch v3.3.0 https://github.com/sodium-friends/sodium-native
pkg_add node
cd s*
node deps/bin.js --print-include --print-lib --print-arch
Using console.log
s in deps/bin.js
narrows down the problem a socket created on a process object by the run function , when passed 'tar' and 'xzv' arguments (after attempting to fetch libsodium from https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz); when it attempts to pipe between sockets .
I saw this , and wonder if there is any reason that OpenBSD might prematurely close the socket?
Possibly relevant links:
https://stackoverflow.com/questions/39739626/what-is-node-gyp
https://stackoverflow.com/questions/58436786/build-of-sodium-native-on-centos-cloud-is-failing
https://stackoverflow.com/questions/39855232/npm-install-fails-with-node-gyp-build-error
https://github.com/prebuild/node-gyp-build/issues/8
https://github.com/nodejs/node-gyp/issues/809
---
*Note: adapted and cross-posted here .*
Lee
(549 rep)
May 4, 2023, 11:08 AM
• Last activity: May 8, 2023, 06:33 PM
0
votes
2
answers
411
views
Installing nodejs in ubuntu via the downloaded file from nodejs website
I have downloaded the nodejs repository from nodejs website and I want to install it via node file in bin directory and I want to install it with gdebi or software installer app but the errors are: - for gdebi see the image: [![image for gdebi error][1]][1] - for software installer see this other im...
I have downloaded the nodejs repository from nodejs website and I want to install it via node file in bin directory and I want to install it with gdebi or software installer app but the errors are:
- for gdebi see the image:
- for software installer see this other image:
Actually I have checked the permissions and activated them and this is the error that I obtain:
run npx create-react-app name
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'ini'
Require stack:
- /usr/share/nodejs/@npmcli/config/lib/index.js
- /usr/share/nodejs/npm/lib/utils/config/definition.js
- /usr/share/nodejs/npm/lib/utils/config/definitions.js
- /usr/share/nodejs/npm/lib/utils/config/flatten.js
- /usr/share/nodejs/npm/lib/utils/config/index.js
- /usr/share/nodejs/npm/bin/npx-cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/usr/share/nodejs/@npmcli/config/lib/index.js:3:13)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/nodejs/@npmcli/config/lib/index.js',
'/usr/share/nodejs/npm/lib/utils/config/definition.js',
'/usr/share/nodejs/npm/lib/utils/config/definitions.js',
'/usr/share/nodejs/npm/lib/utils/config/flatten.js',
'/usr/share/nodejs/npm/lib/utils/config/index.js',
'/usr/share/nodejs/npm/bin/npx-cli.js'
]
}


mohammad
(1 rep)
Oct 10, 2022, 03:23 PM
• Last activity: Nov 2, 2022, 09:03 AM
1
votes
0
answers
167
views
tar.unpack untar error while installing angular in Linux vm
I am installing `Angular` in `Linux VM (3.10.0.1062)` using command `npm install @angular/cli@10.0.5` from `Putty terminal`, getting below error [host@machinename /]$ npm install @angular/cli@10.0.5 npm WARN engine @angular/cli@10.0.5: wanted: {"node":">= 10.13.0","npm":">= 6.11.0","yarn":">= 1.13.0...
I am installing
If I do
Angular
in Linux VM (3.10.0.1062)
using command npm install @angular/cli@10.0.5
from Putty terminal
, getting below error
[host@machinename /]$ npm install @angular/cli@10.0.5
npm WARN engine @angular/cli@10.0.5: wanted: {"node":">= 10.13.0","npm":">= 6.11.0","yarn":">= 1.13.0"} (current: {"node":"0.12.18","npm":"2.15.11"})
npm ERR! tar.unpack untar error /home/usermachine/.npm/@angular/cli/10.0.5/package.tgz
npm ERR! Linux 3.10.0-1062.9.1.el7.x86_64
npm ERR! argv "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/node" "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/npm" "install" "@angular/cli@10.0.5"
npm ERR! node v0.12.18
npm ERR! npm v2.15.11
npm ERR! path /node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/node_modules'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/node_modules']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/node_modules',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/node_modules/@angular/cli',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/nodejs/node-v0.12.18-linux-x64/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:25',
npm ERR! '/usr/local/lib/nodejs/node-v0.12.18-linux-x64/lib/node_modules/npm/node_modules/mkdirp/index.js:35:29',
npm ERR! '/usr/local/lib/nodejs/node-v0.12.18-linux-x64/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.10.0-1062.9.1.el7.x86_64
npm ERR! argv "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/node" "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/npm" "install" "@angular/cli@10.0.5"
npm ERR! node v0.12.18
npm ERR! npm v2.15.11
npm ERR! path npm-debug.log.1371631876
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, open 'npm-debug.log.1371631876'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, open 'npm-debug.log.1371631876'] errno: -13, code: 'EACCES', path: 'npm-debug.log.1371631876' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
This is the space available in my machine

sudo npm install @angular/cli@10.0.5
, getting below error
[host@machinename /]$ sudo npm install @angular/cli@10.0.5
npm ERR! Linux 3.10.0-1062.9.1.el7.x86_64
npm ERR! argv "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/node" "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/npm" "install" "@angular/cli@10.0.5"
npm ERR! node v0.12.18
npm ERR! npm v2.15.11
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
How can I fix this error?
Arvind Chourasiya
(85 rep)
Jan 18, 2021, 08:15 AM
• Last activity: Sep 5, 2022, 02:52 PM
1
votes
0
answers
179
views
Symlink npm to pnpm
My understanding is that `pnpm` is designed to be a drop-in replacement for `npm`. However, I'm not sure if this is true for all cases. Is it safe to just delete `npm` and symlink in `pnpm` or will that break stuff?
My understanding is that
pnpm
is designed to be a drop-in replacement for npm
. However, I'm not sure if this is true for all cases.
Is it safe to just delete npm
and symlink in pnpm
or will that break stuff?
ScottishTapWater
(187 rep)
Jul 23, 2022, 06:40 PM
0
votes
0
answers
813
views
Read string from file and pass to command, keeping dollar sign intact
Consider a string stored in a file, which I need to read and pass to a Node script via NPM. But the string in the file contains a `$`, and is being interpreted as a variable and is replaced before being passed to the command. Note: the reason the string is stored in a file is because it is not somet...
Consider a string stored in a file, which I need to read and pass to a Node script via NPM. But the string in the file contains a
$
, and is being interpreted as a variable and is replaced before being passed to the command.
Note: the reason the string is stored in a file is because it is not something that should appear in the history file.
# store and then read the variable
echo 'my$tring' > x
export X=cat x
./do-it -x $X
./do-it
looks like:
echo $@
npm start -- $@
And the start
script in package.json
looks like:
node ./dist/index.js
---
If I store "my$tring" in the file x
, and output things along the way, it will look like this:
./do-it -x $X
-x my$tring # Result of echo $@ shows includes the $ -- good
> start # Node script "start"
> node ./dist/index.js "-x" "my$tring" # Command being executed by NPM (bad)
my # Result of console.log() with the 2nd arg
In the above, notice how node ./dist/index.js "-x" "my$tring"
is double-quoting the arguments, thereby consuming the $tring
portion of the 2nd argument. **This is what I need to fix**, as it causes the final argument sent to index.js
to be just my
.
Josh M.
(240 rep)
May 20, 2022, 12:57 PM
2
votes
0
answers
663
views
Figuring out which user is best to start pm2
I'm about to deploy a highly secure production server, which is running an nginx reverse proxy, which points to the backend server on nodeJS. When a user starts the server by typing in the *"pm2 start server.js"* command, whichever user ran this command, becomes the owner of the pm2 server. I don't...
I'm about to deploy a highly secure production server, which is running an nginx reverse proxy, which points to the backend server on nodeJS. When a user starts the server by typing in the *"pm2 start server.js"* command, whichever user ran this command, becomes the owner of the pm2 server. I don't want to run it on my account (which has sudo privileges with no password), incase If somehow a hostile party compromises the code, they would be able to run commands as root.
Which user should start pm2 to ensure that if there is compromised code, the attacker won't have full control of the system?
The default user for apache & nginx is www-data, why is there no default user for pm2?
Andrew Elkhoury
(21 rep)
May 13, 2022, 08:12 PM
3
votes
1
answers
1384
views
Is there a way to package npm dependencies into a .deb package for offline deployment?
I've created a very simple debian .deb package that deploys my node-red project to the correct directory structure on a target machine. I also have a number of python/debian dependencies, which I've added to my debian/control file. Everything up to this point works great. Unfortunately I have 3 node...
I've created a very simple debian .deb package that deploys my node-red project to the correct directory structure on a target machine. I also have a number of python/debian dependencies, which I've added to my debian/control file. Everything up to this point works great.
Unfortunately I have 3 node.js npm dependencies as well, and I can't figure out how to get these packages into my .deb file.
The target machines I'm deploying to do not have an internet connection, so I cannot simply run the npm install commands in the .postinst script. I have also tried adding the entire populated node_modules folder to the .deb deployment, but it doesn't work, it seems like there are some relative links that get broken during the deployment?
npm2deb doesn't seem to be what I'm looking for, as it seems to deploy existing npm modules into their own individual .deb files. I simply want to include all my npm dependencies (as well as their own dependencies) to my .deb deployment in the easiest way possible.
Does anyone know of a way I can do this?
Thank you!!
root
(31 rep)
Mar 30, 2019, 12:55 AM
• Last activity: Mar 17, 2022, 05:25 PM
33
votes
4
answers
95179
views
Is there an option to install an npm package without dependencies?
I'm attemting to modify an npm package with multiple dependencies. As such `npm install -g .` takes a long time to execute. Do I have other options besides removing the dependencies from packages.json?
I'm attemting to modify an npm package with multiple dependencies. As such
npm install -g .
takes a long time to execute. Do I have other options besides removing the dependencies from packages.json?
Justin Dearing
(1421 rep)
Nov 14, 2014, 08:26 PM
• Last activity: Mar 16, 2022, 09:18 AM
1
votes
1
answers
740
views
bash/zsh hook - Add to PATH only if no matching file found
I am looking for a bash/zsh *hook*, that is invoked when a command is not found. Say I run some arbitrary executable: xyz foo --bar 1. say that bash/zsh cannot find the executable. 2. is there a way to handle "not found" and then load some libraries to the PATH dynamically after that? something like...
I am looking for a bash/zsh *hook*, that is invoked when a command is not found.
Say I run some arbitrary executable:
xyz foo --bar
1. say that bash/zsh cannot find the executable.
2. is there a way to handle "not found" and then load some libraries to the PATH dynamically after that?
something like this:
function xyz {
if ! test -f xyz; then
load_libs xyz
fi
command -v xyz;
}
something like this function, but it would be for unknown executables.
So generically it would look something like:
function on_not_found {
if ! test -f "$1"; then
load_libs "$1"
fi
command -v "$@";
}
Alexander Mills
(10734 rep)
Feb 18, 2022, 07:21 PM
• Last activity: Feb 21, 2022, 07:24 AM
0
votes
1
answers
457
views
Facing an error while installing npm for neovim coc
I have installed `coc.nvim` and am now installing the dependencies. To do this I need to install npm. The command I'm using to install npm is `sudo apt-get install npm`. However, I get this error when installing it: ``` Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev a...
I have installed
coc.nvim
and am now installing the dependencies. To do this I need to install npm. The command I'm using to install npm is sudo apt-get install npm
. However, I get this error when installing it:
Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-90.101
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-90.101
404 Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.4.0-90.101_amd64.deb 404 Not Found [IP: 91.189.88.142 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I have tried running apt-get update
but I keep getting this error:
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
How do I install npm
?
callmetan7
(1 rep)
Dec 3, 2021, 12:15 PM
• Last activity: Dec 9, 2021, 07:53 AM
0
votes
2
answers
50750
views
lsof command not found in VS Code terminal
I am trying to start up my application with `npm start`, however I get the following errors: `rm: cannot remove 'dist/': Device or resource busy` When I try to run an `lsof` I get the error message: `bash: lsof: command not found`. I noticed that there is no `/usr/sbin/` inside there, but only `/usr...
I am trying to start up my application with
npm start
, however I get the following errors:
rm: cannot remove 'dist/': Device or resource busy
When I try to run an lsof
I get the error message: bash: lsof: command not found
. I noticed that there is no /usr/sbin/
inside there, but only /usr/share
and /usr/ssl/
.
I am using this Visual Studio Code bash terminal from within a Windows 10 environment.
How can I resolve this?
Daniel
(537 rep)
Oct 14, 2020, 06:13 PM
• Last activity: Oct 16, 2021, 09:00 AM
Showing page 1 of 20 total questions