NPM crashes when I try to install packages from package.json - javascript

When i use mikhail#MikhailPC:~/Desktop/restory$ sudo npm i npm returns me Illegal InstructionfetchMetadata: sill install loadAllDepsIntoIdealTree.
mikhail#MikhailPC:~/Desktop/restory$ npm -v
6.13.7
mikhail#MikhailPC:~/Desktop/restory$ node -v
v13.11.0

This error occurs because the Node.js you are trying to execute is not compiled for the processor architecture of your machine.
Run this command: uname -m the result will likely be one of the following:
x86_64: 64 bits
i686: 32 bits
Starting with armv7: ARMv7 (32 bits)
Starting with armv8: ARMv8 (64 bits)
Remove your current Node.js and download the corresponding Node.js release from here: https://nodejs.org/en/download/ or any package manager (note that there is no release for Linux 32 bits).

try to clear the cache of npm with:
npm cache clean
then remove node_modules folder and package-lock.json and try again!

Related

Why after that I installed node 10.1.0 it says that the installed version is the 5.6.0?

I downloaded the NPM Windows installer from here: https://nodejs.org/it/
I downloaded the 10.1.0 version and I installed it.
Why when I go into my console performing node -v statement I am obtaining this output?
C:\Users\nobil>npm -v
openssl config failed: error:02001003:system library:fopen:No such process
openssl config failed: error:02001003:system library:fopen:No such process
5.6.0
It says that the installed version is the 5.6.0 instead the expected one (10.1.0).
What am I missing?
And what are these openssl error messages?
You are requesting the version number of npm, whicht is part of node.
To get the node version, try:
node -v
That is because to see node version you've to do node -v.
npm -v shows you the npm version. npm is the package manager for node.
I downloaded the NPM Windows installer from here: https://nodejs.org/it/
That's the Node.js installer.
npm is a piece of software that is distributed with Node.js, but it isn't Node.js and has its own version number.
See node --version for the Node.js version number.
You can either use node -v or node --version to visualise the node version installed in your system. npm or the node package manager is a big repository for packages or re-usable code that you can use in your node.js application. As such, npm has its own version.

Issue when using npm Windows Upgrade

I've been trying to update npm on windows and found this post which provided a solution where the following commands were supposed to be run:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
The first command executes seemingly correctly, but when I try running the second one, I get this log which seems to indicate that a version of windows upgrade needs to be specified. So I then ran:
npm install -g npm-windows-upgrade 6.9.1 and got this error log
Of course when the last command of npm-windows-upgrade is run, I get the error that it isn't recognized. The other SO post had a solution for either removing both of these files:
C:\Program Files (x86)\nodejs\npm
C:\Program Files (x86)\nodejs\npm.cmd
or
running this command in an elevated powershell:
npm install npm#latest
As I don't have admin rights (and can't really acquire them) on my computer and given that both of these options require admin rights, how can I go about upgrading node.js on Windows?
i never did use npm-windows-upgrade but it seam like you need to run cmd as administration
otherwise i recommande using n
Run cmd as adminstrator and install n using :
> npm install -g n
then Upgrade or install the latest official release using :
> n latest
Upgrade or install the stable official release using :
> n stable
Upgrade or install the latest LTS official release:
> n lts

Travis CI Build Keeps Failing

I have a project that I am trying to incorporate Travis CI into for testing.
For the life of me, Travis CI keeps 'failing' when I do a Pull Request and/or push to my repos on GitHub.
Here is my .travis.yml file:
language: node_js
node_js:
- "node"
before_script:
-npm install -g webpack
-npm install -g mocha
-npm install -g chai
-npm start
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Here is the message from Travis CI about the error:
Using worker: worker-linux-docker-f87d2e7f.prod.travis-ci.org:travis-linux-7
system_info
Build system information
Build language: node_js
Build group: stable
Build dist: precise
Build image provisioning date and time
Thu Feb 5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"
fix.CVE-2015-7547
$ export DEBIAN_FRONTEND=noninteractive
W: Size of file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-backports_multiverse_source_Sources.gz is not what the server reported 5886 5888
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-amd64_Packages.gz is not what the server reported 36669 36677
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-i386_Packages.gz is not what the server reported 36729 36733
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libc-bin libc-dev-bin libc6-dev
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc-bin libc-dev-bin libc6 libc6-dev
4 upgraded, 0 newly installed, 0 to remove and 221 not upgraded.
Need to get 8,844 kB of archives.
After this operation, 9,216 B disk space will be freed.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.13 [2,943 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.13 [84.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.13 [1,179 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.13 [4,637 kB]
Fetched 8,844 kB in 0s (31.7 MB/s)
Preconfiguring packages ...
(Reading database ... 69991 files and directories currently installed.)
Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc6-dev ...
Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc-dev-bin ...
Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc-bin ...
Processing triggers for man-db ...
Setting up libc-bin (2.15-0ubuntu10.13) ...
(Reading database ... 69991 files and directories currently installed.)
Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.13_amd64.deb) ...
Unpacking replacement libc6 ...
Setting up libc6 (2.15-0ubuntu10.13) ...
Setting up libc-dev-bin (2.15-0ubuntu10.13) ...
Setting up libc6-dev (2.15-0ubuntu10.13) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
git.checkout
0.46s$ git clone --depth=50 --branch=master https://github.com/NAME/mood.ly.git NAME/mood.ly
Cloning into 'NAME/mood.ly'...
remote: Counting objects: 1183, done.
remote: Compressing objects: 100% (507/507), done.
remote: Total 1183 (delta 616), reused 1170 (delta 608), pack-reused 0
Receiving objects: 100% (1183/1183), 665.78 KiB | 0 bytes/s, done.
Resolving deltas: 100% (616/616), done.
Checking connectivity... done.
$ cd NAME/mood.ly
$ git checkout -qf 6bb7813f901f8d3cca359f8a9a1124df4dda86fe
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
Updating nvm to v0.31.0
2.25s$ nvm install node
Downloading https://nodejs.org/dist/v6.1.0/node-v6.1.0-linux-x64.tar.xz...
######################################################################## 100.0%
Now using node v6.1.0 (npm v3.8.6)
$ node --version
v6.1.0
$ npm --version
3.8.6
$ nvm --version
0.31.0
install
47.43s$ npm install
npm WARN deprecated jade#0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN excluding symbolic link index.js -> lib/sass.js
npm WARN excluding symbolic link lib/index.js -> sass.js
mood.ly#1.0.0 /home/travis/build/NAME/mood.ly
├─┬ babel-cli#6.8.0
│ ├─┬ babel-polyfill#6.8.0
│ │ └── babel-regenerator-runtime#6.5.0
│ ├── babel-runtime#6.6.1
│ ├─┬ bin-version-check#2.1.0
│ │ ├─┬ bin-version#1.0.4
***A BUNCH OF OTHER DEPENDENCIES* (it goes over 30K characters so I had to redact it)**
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
0.00s$ -npm install -g webpack -npm install -g mocha -npm install -g chai -npm run build-server - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start
/home/travis/build.sh: line 45: eval: -n: invalid option
eval: usage: eval [arg ...]
The command "-npm install -g webpack -npm install -g mocha -npm install -g chai -npm run build-server - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start" failed and exited with 2 during .
Your build has been stopped.
Would really appreciate some help/advice with this.
Thanks in advance.
The command "-npm install -g webpack -npm install -g mocha -npm install -g chai -npm run build-server - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start" failed and exited with 2 during .
This line should be the hint. Your npm has a dash before it (i.e: -npm). Add a space between the - and npm in your configuration.
before_script:
- npm install -g webpack
- npm install -g mocha
- npm install -g chai
- npm start
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

updating node.js in windows 7 64 bit

How to update node.js in Windows 7 64-bit OS?
I tried the famous :
npm cache clean -f
npm install -g n
n stable
But in npm install -g n it failed giving the following error:
C:\Windows\system32>npm install -g n
npm http GET https://registry.npmjs.org/n
npm http 304 https://registry.npmjs.org/n
npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: n#1.2
.9
npm ERR! notsup Valid OS: !win32
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: ia32
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "n"
npm ERR! cwd C:\Windows\system32
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code EBADPLATFORM
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Windows\system32\npm-debug.log
npm ERR! not ok code 0
Please suggest a solution. I suspect this could be because of the 64-bit version of the OS.
Thanks and regards.
You can update simply by executing the Windows installer for the latest node.js version from here.
n doesn't work on Windows because it's basically a giant (bash) shell script.
Go to System-Properties (run: systempropertiesadvanced.exe),
in the Advanced tab, click Environment Variables.
Still on the System variables,
click New, add name: NODE_PATH with value: C:\nodejs64\node_modules and click OK.
click New' again, add name: NODE_SKIP_PLATFORM_CHECK with value: 1 and click OK.
Click OK of all dialogs close.
Restart your machine, so explore and cmd will get the fresh set of variables.
------------------------THIS IS HOW TO UPDATE NODE ON WINDOWS 7---------------------------
Go to https://nodejs.org/en/download/releases and find the version you want and download the .zip file to your appropriate OS. --> 64-bit or x86 for 32-bit
I suggest downloading LTS(long term support)
I can confirm that 16.6.2 works the link is located here
https://nodejs.org/download/release/v16.6.2/
Locate your nodejs folder
If you previously installed it with the installer its in your C:\Program Files\nodejs
copy this folder and save it somewhere else in case you mess things up
Unzip the new version of nodejs that you downloaded and copy all the files in the folder except the node_modules and paste them in your nodejs folder
check yes to replace the files
Open Run (windows key + r) and paste systempropertiesadvanced.exe Then,
in Advanced tab, click Environment Variables. On the System variables area, click 'New', add name: NODE_PATH with value: C:\Program Files\nodejs\node_modules, and click OK.
click 'New' again, add name: NODE_SKIP_PLATFORM_CHECK with value: 1, and click OK.
make sure your NODE_PATH is where ever your nodejs/node_module folder is, mine was in Program Files
restart your computer, so explore and cmd will get the fresh set of variables
In your terminal run node -v and npm -v
You will know you did it right, if it node returns the new version and npm doesn't error
Note you only updated nodejs
I'd imagine you could run npm install -g npm#latest and it would be fine.
I successfully installed Node.js 13.14.0 on my Windows 7 64-bit Service Pack 1. Download here
As #mscdex mentioned in the comment above, you cannot use the bash shell script on Windows.
The correct link to update from Windows would be this one.
Then you should click on the right link saying " Current".

browserify error /usr/bin/env: node: No such file or directory

I installed node js and npm via apt-get install and all of the dependencies, then I installed browserify
npm install browserify -g
it goes through the process and it seems like it installed correctly, but when I try to do a simple bundle per this walkthrough
I get the error:
/usr/bin/env: node: No such file or directory
Some linux distributions install nodejs not as "node" executable but as "nodejs".
In this case you have to manually link to "node" as many packages are programmed after the "node" binary. Something similar also occurs with "python2" not linked to "python".
In this case you can do an easy symlink. For linux distributions which install package binaries to /usr/bin you can do
ln -s /usr/bin/nodejs /usr/bin/node
New Answer:
Uninstall any nodejs package you've installed via your system package manager (dnf, apt-get, etc), delete any silly symlinks you've been recreating every upgrade (lol).
Install NVM,
use nvm to install nodejs: nvm install 6
Old Answer:
Any talk of creating symlinks or installing some other node-package are spurious and not sustainable.
The correct way to solve this is to :
simple install the nodejs package with apt-get like you already have
use update-alternatives to indicate your nodejs binary is responsible for #!/usr/bin/env node
Like so :
sudo apt-get install nodejs
sudo update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100
This now becomes sustainable throughout package upgrades, dist-upgrades and so forth.
Run apt-get install nodejs-legacy.
Certain linux distributions have changed node.js binary name making it uncompatible with a lot of node.js packages. Package nodejs-legacy provides a symlink to resolve this.
You can also install Nodejs using NVM or Nodejs Version Manager. There are a lot of benefits to using a version manager. One of them being you don't have to worry about this issue.
Instructions:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
Once the prerequisite packages are installed, you can pull down the nvm installation script from the project's GitHub page. The version number may be different, but in general, you can download and install it with the following syntax:
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
This will download the script and run it. It will install the software into a subdirectory of your home directory at ~/.nvm. It will also add the necessary lines to your ~/.profile file to use the file.
To gain access to the nvm functionality, you'll need to log out and log back in again, or you can source the ~/.profile file so that your current session knows about the changes:
source ~/.profile
Now that you have nvm installed, you can install isolated Node.js versions.
To find out the versions of Node.js that are available for installation, you can type:
nvm ls-remote
. . .
v0.11.10
v0.11.11
v0.11.12
v0.11.13
v0.11.14
As you can see, the newest version at the time of this writing is v0.11.14. You can install that by typing:
nvm install 0.11.14
Usually, nvm will switch to use the most recently installed version. You can explicitly tell nvm to use the version we just downloaded by typing:
nvm use 0.11.14
When you install Node.js using nvm, the executable is called node. You can see the version currently being used by the shell by typing:
node -v
The comeplete tutorial can be found here
sudo apt-get install nodejs-legacy
This creates the symlink /usr/bin/node -> nodejs.
Source: https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
I seem the same problem when I build atom in Linux.
sudo apt-get install nodejs-dev
Fix my question.hope helpful to you.
If you don't want to symlink you could do this.
works in ubuntu
#!/usr/local/bin/node --harmony
harmony tag is for the new ECMAscript harmony
run the command which node the result will be something
/home/moh/.nvm/versions/node/v8.9.4/bin/node
Copy the path that you have got above then run the command in step 3.
ln -s /home/moh/.nvm/versions/node/v8.9.4/bin/node /usr/bin/node
You have to call "nodejs" and not "node". To verify this, type node -v on the shell: if nothing is found try nodejs -v. If that displays a version number, then the command you should be using is nodejs and not node. Therefore, you have to change the call to browserify in your script from node to nodejs (as shown below): replace
#!/usr/bin/env node
with
#!/usr/bin/env nodejs
You might also have to open the script as the superuser.

Categories