error Error: EROFS: read-only file system, mkdir '/user' - npm-install

I am trying to install NPM Install Sharp.
Error
EROFS: read-only file system, mkdir '/user'

Related

Module not found: Error: Package path ./lib/index is not exported from package /node_modules/highlight.js

I'm using Laravel, When I run npm run dev, it shows this:
ERROR in ./resources/assets/vendor/libs/highlight/highlight.js 4:0-42
Module not found: Error: Package path ./lib/index is not exported from package /home/wwwroot/myproject/node_modules/highlight.js (see exports field in /home/wwwroot/myproject/node_modules/highlight.js/package.json)
I checked /home/wwwroot/myproject/node_modules/highlight.js and there is ./lib/index.js
I've changed these in myproject before running npm run dev with root, but nothing changed:
chmod 775 myproject -R
chown www:www -R myproject

Gulp installation errors on terminal

When I install gulp using npm install gulp-cli -g
It shows me an error in the picture below. Can someone help me?
I have tried to change administrator access and delete node_modules in my hard drive, but it still shows me errors
When you install packages globally, by default, npm will install them in /usr/local/lib/node_modules which requires
root permissions.
There are 3 solutions to your problem:
Install the package as root user
sudo npm install -g gulp-cli
Change the owner of /usr/local/lib/node_modules
sudo chown -R your_user_name: /usr/local/lib/node_modules
Recommended: Manually change npm’s default directory
In your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and
add this line:
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
source ~/.profile
To test your new configuration, install a package globally without using sudo:
npm install -g gulp-cli

npm: Unhandled rejection Error: EISDIR: illegal operation on a directory, open ‘/Users/me/.npm/_cacache/content-v2/sha512/b3/da’

On my Mac, I just updated my working npm version from 5.6 to 6.9 thusly:
sudo npm i -g npm
Then I tried to install cordova like this:
sudo npm install -g cordova
And get
Unhandled rejection Error: EISDIR: illegal operation on a directory,
open '/Users/me/.npm/_cacache/content-v2/sha512/04/89'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2019-04-02T11_50_57_678Z-debug.log
I tried to downgrade thusly:
sudo npm install -g npm#6.4.1
but this fails with hundreds of lines like this:
npm WARN tar EISDIR: illegal operation on a directory, open '/tmp/npm-30934-a3ac319a/unpack-28da209e/bin/node-gyp-bin'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/me/.npm/_cacache/content-v2/sha512/99/72'
I also tried making sure the ownership was correct:
sudo chown -R $(whoami) ~/.npm
There are lots of posts of various EISDIR (error is a directory) problems for other directories (such as /usr/lib/modules), but no solutions seem to work.
Also, the npmrc file does not seem to exist. If I do:
npm config ls -l
globalconfig = "/usr/local/etc/npmrc"
userconfig = "/Users/me/.npmrc"
but neither file exists.
Note, I dont have homebrew, and didnt install it that way (I usually do manual installs).
I also tried this:
sudo npm cache clean -f
This did not help.
What else can I try? should I try deleting the ~/.npm dir?
Looking for a way to uninstall node, I found many old posts with long and sometimes conflicting lists of files to remove. Not sure if this will make it worse.
Any suggestions?
I think I have found a solution. I did the following:
installed node from the Mac pkg installer from https://nodejs.org/en/ This downgraded npm to 6.4.1 which is the version before EISDIR problems start apparently.
chmod -R 777 ~/.npm/_cacache // yes, this is not good
chown -R me ~/.npm/_cacache
After this, I could install cordova using "sudo npm install -g cordova" without errors.
I had the same problem when I upgraded to npm 6.9.0. You have to upgrade node to the last version:
brew reinstall node
At this time I have installed the latest available version for Mac OS Mojave (node: v11.14.0 and npm 6.9.0).
After node upgrade, I was able to install packages globally again.
Changing the ownership of files and then avoiding the use of sudo is a possible workaround for EISDIR with global installs using sudo. I suppose you have installed to default location folder:
sudo chown -R <user> ~/.npm
sudo chown -R <user> /usr/local/lib
sudo chown -R <user> /usr/local/bin
After this sequence, it worked to me.

Getting npm install issues when build angular2 source

I want to build angular2 source on my windows 8.1 x64 dev PC.
Node version 5.1.0
Npm version 3.3.12
1) cloned the repo - OK
2) run bower install - OK
3) run npm install - Errors:
npm ERR! tar.unpack unzip error C:\Windows\Temp\npm-11016-2e7afc52\registry.npmj
s.org\fsevents\-\fsevents-1.0.2.tgz
npm ERR! tar.unpack untar error C:\Windows\Temp\npm-11016-2e7afc52\registry.npmj
s.org\fsevents\-\fsevents-1.0.2.tgz
npm ERR! tar.unpack unzip error C:\Windows\Temp\npm-11016-2e7afc52\registry.npmj
s.org\firefox-profile\-\firefox-profile-0.3.9.tgz
npm ERR! tar.unpack untar error C:\Windows\Temp\npm-11016-2e7afc52\registry.npmj
s.org\firefox-profile\-\firefox-profile-0.3.9.tgz
Do you have any ideas how can I fix that?
I tried to cleanup the cache and also make sure that it is actually did by lookin in to npm cache folder C:\Users\Me\AppData\Roaming\npm-cache. Also I was trying to reclone the repo an run a precess again multipe times but npm install just continue to throw the same exeptions again and again
Use the following process
Create C:\Windows\Temp\ if it does not exist
Create a dummy folder within C:\Windows\Temp\ if it does exist
Run npm config ls -l
Temporary files are stored by default in the folder specified by the tmp config, which defaults to the TMPDIR, TMP, or TEMP environment variables, or /tmp on Unix and c:\windows\temp on Windows.
Temp files are given a unique folder under this root for each run of the program, and are deleted upon successful exit.
Change the tmp var to a new path by editing one of the .npmrc files:
The four relevant files are:
per-project config file (/path/to/my/project/.npmrc)
per-user config file (~/.npmrc)
global config file ($PREFIX/etc/npmrc)
npm builtin config file (/path/to/npm/npmrc)
References
npmrc man page
npm folders: temp files

Permissions denied to override or delete node targets

I've been running into an issue where every time I've attempted to run an npm install command I receive an error: '-bash: npm: command not found'
So I've attempted to uninstall and reinstall both node and npm using homebrew, but still running into a few errors. After I've uninstalled both, I have run the command: "brew doctor" and I get "Your system is ready to brew."
First I attempt to install node: "brew install node", but I get the following:
==> Downloading https://homebrew.bintray.com/bottles/node-
0.12.7.yosemite.bottle
Already downloaded: /Library/Caches/Homebrew/node-0.12.7.yosemite.bottle.tar.gz
==> Pouring node-0.12.7.yosemite.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/systemtap/tapset/node.stp
Target /usr/local/share/systemtap/tapset/node.stp
already exists. You may want to remove it:
rm '/usr/local/share/systemtap/tapset/node.stp'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
Possible conflicting files are:
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
==> Summary
🍺 /usr/local/Cellar/node/0.12.7: 2726 files, 31M
Jamess-MacBook-Pro:~ jamesbradley$
So then I attempt to remove the target:
Jamess-MacBook-Pro:~ jamesbradley$ rm
'/usr/local/share/systemtap/tapset/node.stp'
override rw-r--r-- root/admin for /usr/local/share/systemtap/tapset/node.stp? y
rm: /usr/local/share/systemtap/tapset/node.stp: Permission denied
Jamess-MacBook-Pro:~ jamesbradley$
and I get the following:
rm: /usr/local/share/systemtap/tapset/node.stp: Permission denied
so then I attempt to override and I get this error:
Linking /usr/local/Cellar/node/0.12.7...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
Jamess-MacBook-Pro:~ jamesbradley$
I've also attempted to brew postinstall node and I get this response:
Error: Permission denied - /usr/local/lib/node_modules/npm
Jamess-MacBook-Pro:~ jamesbradley$
I've also attempted to run a number of other commands:
sudo chown -R `whoami` /Library/Caches/Homebrew/
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
but nothing seems to be working.
Does anyone know how I can obtain permissions to delete and/or how to make these files writable so I can either overwrite or delete them?
Remove the folder
sudo rm -rf /usr/local/share/systemtap/
Remove all the node installed previously if you want.
brew uninstall node
Then reinstall node
brew install node
I had the same issue, worked for me.