ERRORS: Trying to install truffle to terminal - node.js

I'm completely new at this and keep getting an error message trying to install truffle. If I need to delete or add anything please explain in detail how to do so.
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/paulbrady/.npm-global/lib/node_modules/truffle
npm ERR! dest /Users/paulbrady/.npm-global/lib/node_modules/.truffle-f258BAu1
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/paulbrady/.npm-global/lib/node_modules/truffle' -> '/Users/paulbrady/.npm-global/lib/node_modules/.truffle-f258BAu1'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/paulbrady/.npm/_logs/2021-05-19T09_32_00_700Z-debug.log
paulbrady#Pauls-MacBook-Air ~ %

I had similar issue and this is how I solved it
Remove the already installed truffle
sudo -i
cd /usr/local/lib/node_modules/
rm -r truffle .truffle_
Make sure Ganache is running first before reinstalling truffle again
Install Truffle: npm install -g truffle

Related

uninstalling broken node packages for react native

I am working on a react native app and I had to install node and expo-cli to start the app but recently I have been having issues with running the app. When I run npm start, I get the error expo: command not found so I install the expo-cli using npm install --global expo-cli I get this error:
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /Users/{usr}/.npm-global/lib/node_modules/expo-cli
npm ERR! dest /Users/{usr}/.npm-global/lib/node_modules/.expo-cli-F3yBqKce
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 501:20 "/Users/{usr}/.npm"
I ran the sudo chown -R 501:20 "/Users/{usr}/.npm command but it still does not work.
So I tried to uninstall node and start all over but the issue still persists. Does anyone know a way to fix these issues? Like is there a way I can reset my packages or something like that?
Thanks in advance!

Angular 2/4 npm install issue

When i try to to install angular via npm i get this error message:
npm install -g #angular/cli
npm ERR! path C:\Users\myname\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\acorn
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\myname\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\acorn' -> 'C:\Users\myname\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\.acorn.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myname\AppData\Roaming\npm-cache\_logs\2017-07-26T15_20_28_022Z-debug.log
current setup:
node -v
v6.11.1
npm -v
5.3.0
VOILA!! I found the answer. Actually i can't claim that is a real answer to the problem but it worked damn well. So what i did is, i ran bash as administrator (i did this many times before but didn't worked), and i did next:
$npm cache verify (to see what will happen after i deleted some stuff, uncompleted angular package in node_modules directory for example)
$npm update ( update all outdated local packages )
$npm update -g ( update global packages )
$npm install -g #angular/cli
Maybe running bush as administrator wasn't necessary, maybe just npm update was enough. Anyway, i hope this solution will be helpful to someone.

NPM permission error while installing

i am trying to install yeoman on my server but for some reason do i keep getting a permission denied error.
$npm install -g yo
/root/.node/bin/yo -> /root/.node/lib/node_modules/yo/cli.js
> yo#1.3.3 postinstall /root/.node/lib/node_modules/yo
> yodoctor
sh: 1: yodoctor: Permission denied
npm ERR! yo#1.3.3 postinstall: `yodoctor`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the yo#1.3.3 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! yodoctor
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.13.0-37-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /root
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
i have tried to reinstall ubuntu (14.04) but nothing works.
I think Shantaru is right, you need to do it with sudo.
Try this
sudo npm uninstall -g yo
sudo npm cache clean
sudo npm install -g yo
I have a similar problem weeks ago and that works.
Edit: If that didn't work, do this before:
npm config set unsafe-perm true
You need to have root permission to install this so try
"sudo npm install -g yo" instead of "npm install -g yo"
I had the same issue and tried running the install using 'sudo npm install -g yo' but it still failed. I couldn't get away from the fact that the error message still said 'sh: 1: yodoctor: Permission denied', indicating a permissions issue. I therefore tried completely changing to the root user using 'sudo su' and THEN running 'npm install -g yo'. This worked for me.
If, like me, when running the install that way you encounter other errors, it could be because you need to upgrade npm first (run 'npm install -g npm' to do that). It could also be because you have yo partially installed from your previous attempts and that's causing issues. Therefore you can try removing it first using 'npm remove -g yo' (still as root user) and then installing it again using 'npm install -g yo'.
Hope this helps someone out there.
To avoid permission errors, install node with nvm.
See the detailed solution here:
npm install g less does not work

NPM won't install any package on Mac. New, clean build. `EACCES` & other errors

I've just rebuild my Mavericks (Mac OS X Version 9.4) machine from scratch. I am the administrator and only user of this machine.
I installed Git via their git-2.0.1-intel-universal-snow-leopard.pkg (http://git-scm.com/downloads) in their default /usr/local/git/bin/git location.
I installed Node via their node-v0.10.30.pkg (http://nodejs.org/download/) in their default /usr/local/bin/node location.
The final step of Node's installer package included a note that they also installed NPM in their default /usr/local/bin/npm location.
My $PATH echoes /usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin (it contains /usr/local/bin).
Running npm install -g bower results in:
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Home
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! fstream_path /usr/local/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Home/npm-debug.log
npm ERR! not ok code 0
Running similar installations (npm install -g yo, npm install -g grunt, npm install -g nvm, npm install -g npm) results in what appears to be the same list of errors.
Several people online suggest forcing the installation via sudo, but several others warn this could cause later issues. The manuals for these packages seem not to mention requirement of sudo, and in some cases, they have advised contacting NPM when this issue arises.
Running npm cache clear does not correct the issue.
Running ls -la in the home (~) directory shows my Mac OS X username as the owner of my .npm directory: drwxr-xr-x 15 admin staff 510 Aug 11 23:53 .npm
Does anyone know what has gone wrong and how to correct this? Thank you.
By the way, I solved this issue by changing the owner of /usr/local to be myself, in order to allow NPM to modules in its default location without further requiring sudo for each package's installation.
sudo chown -R `whoami` /usr/local
EACCES is an error of not having access on doing an operation.
Taken the line: npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' we can see that npm was unable to create a directory in the given location.
The reason is very likely that you are not running the command as super user. In fact, the error log is even suggesting that:
npm ERR! Please try running this command again as root/Administrator.
To run as administrator, you have to prefix those commands with sudo. That is:
sudo npm install -g bower. You will be required to type in a password for security reasons.
to start fresh remove prior node.js and npm installs as well as these :
~/.npmrc
~/.npm
~/tmp
~/.npm-init.js
to install nodejs and npm as yourself NOT root do these commands (linux) :
mkdir ${HOME}/bin
download source from : http://nodejs.org/download/
cd v0.10.30/
./configure --prefix=${HOME}/bin/nodejs
make -j8
make install
which puts it into dir defined by above --prefix
export PATH=${HOME}/bin/nodejs/bin:$PATH
NODE_PATH so node can find dir for modules otherwise
npm install xxx will put newly installed module into dir in curr dir :
export NODE_PATH=${HOME}/bin/nodejs/lib/node_modules
do above AND use syntax : npm install xxxxx -g
always use the -g for global
nodejs install gives you npm as well :
ls -la ${HOME}/bin/nodejs/bin
I'd recommend that you install Node.js using a version manager such as nvm. This way, you kill two birds with one stone:
First, you can manage multiple versions of Node.js on the same machine (which you will want to do sooner or later).
Second, you get around all the access problems you experience when installing Node.js without it. At least that's my experience.
Basically it's as easy as running
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.24.1/install.sh | bash
from the command line.
(SOLUTION ANSWER)
Hi Guys,
I had the same problem on my MacBook Pro 2018. After trie installing any dependency globally (with "-g" or "--global") I did receive an issue "EACCES" error (it's about permissions)
You could simply add "sudo" before your commands what will force it.
For example:
sudo npm install gulp -g
or
sudo npm install browser-sync -g
Enjoy!
It's generally not advised to run sudo unless absolutely necessary.
For issues like this, NPM can solve many issues, and allow multiple node versions to be used, and selected depending upon your use case.
I had a similar issue setting up a new machine, and installing NPM took care of the issue.

error when type 'sudo npm install -g meteorite'

I'm trying to install the meteorite. I've success to install nodejs(v0.10.7).and when I type 'sudo npm install -g meteorite'. It comes the error below. I think it may exist some problem with npm(1.2.21). But I do not how to solve it. And I use ubuntu12.10 64bit. Any ideas?
npm http GET https://registry.npmjs.org/meteorite
npm http 304 https://registry.npmjs.org/meteorite
npm ERR! Error: ENOTDIR, mkdir '/home/icarus/tmp/npm-5885/1369411459617-0.27502001402899623'
npm ERR! If you need help, you may report this log at:
npm ERR! or email it to:
npm ERR! npm-#googlegroups.com
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "meteorite"
npm ERR! cwd /home/icarus
npm ERR! node -v v0.10.7
npm ERR! npm -v 1.2.21
npm ERR! not ok code 0
For those who landed here first like me, this is usually an issue with a tmp folder in your root directory followed by npm trying to install from the cache. This should fix it:
rm -rf ~/tmp
sudo npm cache clear
sudo npm install -g meteorite
If you still get the ENOTDIR error you can try making the directory yourself, clearing the cache, and reinstalling, but it looks like removing the tmp folder usually does the trick.
Props to Coombesy for posting this solution here.

Resources