work with debian testing repositories pointing to testing. I installed node, and express npm following some tutorials and I made some mistakes by not paying attention.
1.- First I did the following as root:
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manag ...
# echo sid main deb http://ftp.us.debian.org/debian/> /etc/apt/sources.list.d/sid.list
# apt-get update
# apt-get install nodejs # Documentation is great.
# node-v v0.4.12
2.- You should then have done the following http://www.freshblurbs.com/install-node-js-and-express-js-nginx-debian-lenny:
$ cd
$ curl http://npmjs.org/install.sh | sh
$ which npm
but rather as a user I did not realize and what I did as root and it did not change the directory, ie do the following:
# Curl http://npmjs.org/install.sh | sh
# Which npm
/usr/bin/npm
and if I go to that directory permissions are for root, but not whether they should be user.
/usr/bin $ ls-la npm
lrwxrwxrwx 1 root root 38 Jan 7 20:09 npm -> .. /lib/node_modules/npm/bin/npm-cli.js
3.- In making the last step:
$ npm express install
$ express /tmp/foo&&cd/tmp/foo
or this to install for global
$ npm install-g express
$ express /tmp/foo&&cd/tmp/foo
and did the first, but when attempting the second with
$ npm install-g express
I get these errors
$ npm install-g express
npm ERR! Could not create / usr / lib / node_modules / ___express.npm
npm ERR! Error installing express#2.5.4 Error: EACCES, Permission denied '/ usr / lib / node_modules / ___express.npm'
npm ERR! Error: EACCES, Permission denied '/ usr / lib / node_modules / ___express.npm'
npm ERR! Report this * Entire * log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Linux 3.0.0-1-amd64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "express"
npm ERR! cwd /home/luis
npm ERR! node-v v0.4.12
npm ERR! npm-v 1.0.106
npm ERR! path/usr/lib/node_modules/___express.npm
npm ERR! EACCES code
npm ERR!
npm ERR! Additional logging Can be found in details:
npm ERR! /home/luis/npm-debug.log
npm not ok
Total I have a major mess, as there are in that situation I am.
I tested with this as helloworld.js node
var sys = require ('sys');
sys.puts ('Hello World');
and making a
$ Node helloworld.js
Hello World
It works, but I want to install Express to develop.
Is it a problem to install it as root?
Can you help me?
I met the same problem like yours.
My solution is:
$ sudo npm install-g express
instead of:
$ npm install-g express
Enter my password. It shows:
Usage: npm
where is one of:
adduser, apihelp, author, bin, bugs, c, cache, completion,
config, deprecate, docs, edit, explore, faq, find, get,
help, help-search, home, i, info, init, install, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, restart, rm, root,
run-script, s, se, search, set, show, star, start, stop,
submodule, tag, test, un, uninstall, unlink, unpublish,
unstar, up, update, version, view, whoami
npm -h quick help on
npm -l display full usage info
npm faq commonly asked questions
npm help search for help on
npm help npm involved overview
Specify configs in the ini-formatted file:
/Users/(your personal account name)/.npmrc
or on the command line via: npm --key value
Config info can be viewed via: npm help config
npm#1.1.1 /usr/local/lib/node_modules/npm
It works. Hope my solution can help you;-)
You may try sudo npm express install, and then enter your password of your system account
when you install with:
npm install somemodule -g
it installs the somemodule in /usr/local/lib/node_modules (-g: globally/system-wide) To successfully install a module globally, you'll need write access to the destination directory. Hence the need for sudo npm ...
if instead you do:
npm install somemodule
2 choices there:
somemodule gets installed in ~/.npm for the current user only (at least on Ubuntu)
if a package.json file exists in the current directory, somemodule gets installed in the ./node_modules directory.
Note(1): npm temporarily uses ~/tmp during the installation. if this directory doesn't already exist, it gets created. if using sudo npm, it will do so with 'root' ownership, which will later yield an install error unless npm is again run with sudo. Fix: chowm -R whoami ~/tmp
Note(2): to use global modules, make sure that you have NODE_PATH defined in your environment.
i had the same problem of installing express due to version compatibility, based on the following link : http://expressjs.com/migrating-4.html
i run the following commands :
1- npm uninstall -g express
2 npm install -g express-generator
3- express --version
the last command retunrs 4.9.0 as version
Related
I have this configuration:
$ node -v
v16.13.0
$ npm -v
8.1.2
$ npm config get shrinkwrap
true
$ npm config get package-lock
true
FWIW I'm on macOS 10.15.17 and Node.js is installed via MacPorts.
When I run npm install or npm install --package-lock-only there is no package-lock.json which is created. There is, however, this:
$ ls -l node_modules/.package-lock.json
-rw-r--r-- 1 david admin 301536 Dec 14 18:48 node_modules/.package-lock.json
That date is within the last 10 minutes. I have removed node_modules and rerun the install. And, I have run npm cache clean --force.
When I run npm install the output talks about some moderate severity vulnerabilities. I obviously want to learn more, but get this:
$ npm audit
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/david/.npm/_logs/2021-12-15T02_48_57_735Z-debug.log
Running npm audit fix or npm audit fix --force doesn't change anything.
The first message - requires a lockfile - why isn't node_modules/.package-lock.json good enough?
The debug log doesn't contain any useful information.
I have read several postings on stackoverflow and elsewhere and have collected the recommended information. Supposedly with this config, the file should be created, and then npm audit would be happy. But, it's not.
I am trying to install etherlime on Ubuntu 16.04 and npm 6.5.0:
sudo npm install etherlime
Even if I run the above command with sudo it gives me this error:
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/LimeChain/solidity-coverage.git /home/username/.npm/_cacache/tmp/git-clone-823333ab
npm ERR! /home/username/.npm/_cacache/tmp/git-clone-823333ab/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/username/.npm/_logs/2019-01-07T08_00_45_775Z-debug.log
Try this one
npm i -g etherlime
or refer this link https://www.npmjs.com/package/etherlime
I've never used etherlime but you do not need to use sudo when using the npm command. Maybe npm is installed in a wrong way or You have an error due to the permissions of your directory.
Try with this:
sudo chown -R username directory.
I need the error logs to understand what the problem is, but remember to use npm in a sub-directory and not in the user's home directory.
mkdir folderName
cd folderName
npm install etherlime
You can found this answer useful.
Obviously before to try this You have to install etherlime globally (npm install -g etherlime)
I ran npm install in angular2+ project directory and got below error which I cannot understand at all.
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\bin\git.EXE ls-remote -h -t ssh://git#bitbucket.org/path/projectname.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
I have created ssh key on bitbucket and account and saved it on drive. |
I have clone project from bitbucket.
What does this error has to do with that?
As I am new on project so don't have much knowledge.
Do I need to provide ssh key while npm install as well?
Please let me know if I can provide more info related to question.
Thanks!
Please check the npm version that you are using. Npm comes bundled with node and you shouldn't have multiple instances on your classpath.
Hey yup, I thought as much, but seeing as I had updated npm to the
latest version ( I even uninstalled node and reinstalled ) with the
same result. npm -v still showed the same version - 1.4.9.
FYI for others that may have the same issue. I also have Chocolatey
installed, and it seems that npm was also installed via Chocolately
which seems to overide the npm path. Uninstalling npm from Chocolately
resolved the npm version issue.
After that angular/cli installs correctly from npm.
https://github.com/angular/angular-cli/issues/6313#issuecomment-301360623
I'm a newbie to npm and hyperledger fabric-composer
Question: What is the problem with my setup? What is the strategy to investigate and solve such errors?
What I did:
Setup Ubuntu Linux 14.04 LTS (64-bit)
Installing prerequisites using the script provided on
https://fabric-composer.github.io/tasks/prerequisites.html
Executing npm install causes (don't know if this info is sufficient):
[...]
File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 22, in <module>
urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/home/mjh/.nvm/versions/node/v4.6.2/bin/node" "/home/mjh/.nvm/versions/node/v4.6.2/bin/npm" "install"
npm ERR! node v4.6.2
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! getting-started#1.0.0 install: `scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the getting-started#1.0.0 install script 'scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork'.
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 getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls getting-started
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/mjh/sample-applications/packages/getting-started/npm-debug.log
See link for detailed npm-debug.log file
https://gist.github.com/mjh-halder/9fe473b44f0a731c996bbc5754011013
I've seen this problem before on trusty (14.04) and relates to an out of date urllib3 library for python, which is used by docker compose.
depending on which version of pip you have installed you can update the urllib library as follows
pip install --upgrade pip
pip install -U urllib3
You are missing permissions, so you need to do sudo npm-install ...
The issue here is related to the last part of the installation script - this is the part that installs the docker-compose tool. Testing this today on a clean Ubuntu 14.04 LTS image, that was the cause.
I'd recommend installing docker-compose following the instructions on the docker site. (https://docs.docker.com/compose/install/)
In effect this is
curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname -s)-$(uname -m)" -o
chmod +x /usr/local/bin/docker-compose
Run the docker-compose --version to check it's installed correctly
$ docker-compose --version
docker-compose version: 1.10.0
Then run the rest of the Fabric Composer scripts as before.
We're updating the script - but this should get you going.
I just tried to do a npm install but get this error about doctor,js at the end. Do I need to worry about it?
npm install -g yo
.
.
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/fstream/-/fstream-0.1.25.tgz
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js
> yo#1.1.0 postinstall /usr/local/lib/node_modules/yo
> node scripts/doctor.js
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`
npm ERR! `sh "-c" "node scripts/doctor.js"` failed with 1
npm ERR!
npm ERR! Failed at the yo#1.1.0 postinstall script.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/doctor.js
npm ERR! You can get their info via:
npm ERR! npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /etc/libvirt/qemu
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /etc/libvirt/qemu/npm-debug.log
npm ERR! not ok code 0
EDIT____________--
for some reason node -v outputs nothing in terminal
I have the latest node installed:
WebstormProjects # sudo apt-get install node
Reading package lists... Done
Building dependency tree
Reading state information... Done
node is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 143 not upgraded.
The solution at this link has worked for me:
http://plaidzooks.tumblr.com/post/36894116867/using-node-js-on-debian-ubuntu-systems
Ubuntu comes with a package that automatically creates a link so the command 'nodejs' can be invoked as 'node' only by creating a link.
sudo apt-get install nodejs-legacy
And that got Yeoman working.
Likewise I had this same problem (albeit on a Mac). I uninstalled and upgraded node to the latest version (v0.10.24) but without success.
The symlink fix did work for me, although with a slight tweak:
sudo ln -s /usr/local/bin/node /usr/bin/node
I believe this may be due to the way which node was installed on your system. Apparently, sometimes when installing Node via a package manager, the linked binary is nodejs, (thus nodejs _command_ is the command that works on your machine, not the much more common node _comamand_. You can either re-install Node (the latest version is now 0.10.24) from nodejs.org, or try this solution from this related issue:
For anyone wishing to still use their OS's package of node the simple solution for this is to determine where node is installed on your OS and then create a symbolic link.
For example I had the issue on ubuntu and the install directory is /usr/bin. To create the symlink you can run:
sudo ln -s /usr/bin/nodejs /usr/bin/node
in windows you can use the mklink command.. Be sure to open the command prompt as a administrator
You have to install nodejs in this way:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
I had this same error on a clean Ubuntu 13.10 install and no amount of sym linking (node > nodejs) or installing/uninstalling helped me.
I don't have a deep enough understanding of the node environment to troubleshoot it properly but I was able to install Yeoman globally by cloning the repo and removing the postinstall check from package.json.
If anyone else want's to try this solution:
Clone Yeoman..
cd ~
git clone https://github.com/yeoman/yo
Edit the package.json..
nano yo/package.json
.. to remove these lines..
"scripts": {
"test": "grunt",
"postinstall": "node ./scripts/doctor",
"postupdate": "node ./scripts/doctor"
},
Then, install it using npm..
cd yo
npm install -g
If you want to clean up you can remove the Yeoman repo..
cd ..
rm -R yo/
Obviously your mileage may vary but it's working fine for me so far.
I also noticed I was able to successfully run the doctor.js script independent of the installation process. No idea why it was failing so hard in the first place..
On Ubuntu 14.04, I tried both installing the legacy package (per Antonio's answer) and creating the symlink manually (per Stephen's answer). Neither worked. The Ubuntu package has version 0.10.25 of node.js, but Yeoman seems to require a newer version.
After installing the latest version of node.js from NodeSource (currently v6.9.1), I was able to install Yeoman using npm install -g yo .
To solve this problem you need to install the package nodejs-legacy.
sudo apt-get install nodejs-legacy