I'm unable to get npm installed correctly in my laravel project. I'm running laravel on a vagrant box (ubuntu-trusty-64). When I run 'npm install' I get the first error in my pastebin (linked below). I then found somewhere below that I should run it without symlinks when using a vagrant box on a windows host os so I then ran 'npm install --no-bin-links' and I was still getting the first error. So then with some help I ran 'rm -rf node_modules' then ran the 'npm install --no-bin-links' and it appears to work but hangs see second half of the pastebin.
Please help!
pastebin: https://pastebin.com/wuRkjqi6
Update:
Just to update everyone on the status, I completely removed npm and reinstalled it following:
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
for node.js 8
I then ran 'sudo npm install --no-bin-links --verbose' directly from the host vm via virtualbox bypassing the vagrant ssh; but it still bombs out on me; this time with an error. but still surrounding fsevents.
27990 info lifecycle vue#2.4.2~postinstall: vue#2.4.2
27991 verbose unlock done using /home/vagrant/.npm/_locks/staging-71408633a969dee2.lock for /home/vagrant/projects/MusekClub/node_modules/.staging
27992 verbose stack Error: ETXTBSY: text file is busy, rmdir '/home/vagrant/projects/MusekClub/node_modules/fsevents/node_modules'
27993 verbose cwd /home/vagrant/projects/MusekClub
27994 verbose Linux 3.13.0-125-generic
27995 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--no-bin-links" "--verbose"
27996 verbose node v8.2.1
27997 verbose npm v5.3.0
27998 error path /home/vagrant/projects/MusekClub/node_modules/fsevents/node_modules
27999 error code ETXTBSY
28000 error errno -26
28001 error syscall rmdir
28002 error ETXTBSY: text file is busy, rmdir '/home/vagrant/projects/MusekClub/node_modules/fsevents/node_modules'
28003 verbose exit [ -26, true ]
Lastly I tried rebuilding the vagrant box from scratch this morning and when I re-ran 'sudo npm install --no-bin-links --verbose' from the virtualbox host I get the following:
vagrant#vagrant-ubuntu-trusty-64:~/projects/MusekClub$ sudo npm install
npm ERR! path /home/vagrant/projects/MusekClub/node_modules/fsevents/build/Release/.deps/User/eshanker/Code/fsevents/lib
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rmdir
npm ERR! ETXTBSY: text file is busy, rmdir '/home/vagrant/projects/MusekClub/node_modules/fsevents/build/Release/.deps/Users/eshanker/Code/fsevents/lib'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2017-08-09T12_45_58_590Z-debug.log
I removed the standard dependencies from the default laravel 5.4 package.json file. I then installed each one, one by one. I found that my issue only occurs when installing the "laravel-mix": "^1.0" dependency line.
I was able to overcome my issue by ditching npm and utilizing yarn. Seems to get past the fsevents module as reading it as an optional dependency. Given what I've researched it appears that fsevents isn't supported on linux anyways.
vagrant#vagrant-ubuntu-trusty-64:~/projects/MusekClub$ sudo yarn install
yarn install v0.27.5
Resolving packages...
Fetching packages...
warning fsevents#1.1.2: The platform "linux" is incompatible with this module.
info "fsevents#1.1.2" is an optional dependency and failed compatibility check.
Excluding it from installation.
Linking dependencies...
Building fresh packages...
Done in 67.15s.
npm install --no-optional helped me, but it is merely dodging the problem.
Using vagrant I was able to get around this by removing --node-bin-links and running my vagrant box as admin. I'm using roughly the same versions of node and npm.
Related
In my server(CentOS 7.2) I install the dependencies:
npm install
But I get bellow error:
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! unexpected end of file
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-11T21_03_20_261Z-debug.log
in the /root/.npm/_logs/2018-02-11T21_03_20_261Z-debug.log, the info is bellow:
10234 verbose bundle EBUNDLEOVERRIDE: Replacing npm#1.4.29's bundled version of readable-stream with readable-stream#1.0.34.
10235 verbose unlock done using /root/.npm/_locks/staging-ace74a3b0cf47932.lock for /home/ubuntu/source_code_web/vue_admin_site/node_modules/.staging
10236 warn The package iview is included as both a dev and production dependency.
10237 warn npm#1.4.29 had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.
10238 verbose type OperationalError
10239 verbose stack Error: unexpected end of file
10239 verbose stack at Gunzip.zlibOnError (zlib.js:152:15)
10240 verbose cwd /home/ubuntu/source_code_web/vue_admin_site
10241 verbose Linux 3.10.0-327.el7.x86_64
10242 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
10243 verbose node v8.4.0
10244 verbose npm v5.3.0
10245 error code Z_BUF_ERROR
10246 error errno -5
10247 error unexpected end of file
10248 verbose exit [ -5, true ]
I tried useļ¼
npm cache clean
to clean the npm, but fails:
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-11T21_13_51_943Z-debug.log
Try cleaning the cache with the command npm cache clean --force and retry your npm install.
"npm cache clean --force"
"npm cache verify"
following steps helped me!! :-)
if problem still persist : "npm i npm"
In the end, I delete the node_modules:
rm -rf node_modules
and deleted the package-lock.json,
then re-install:
npm install
It works for me.
As suggested in npm GitHub
Node 8.9.0+ (and 9+) fix an issue where streams are terminated early
in some scenarios. If you're getting this error upgrade to 8.9.
So you can just try to update your node and npm
I was trying this on Windows 10 and the only solution that worked for me was updating npm by giving
npm install npm#latest -g
None of the listed solutions helped in my case. I solved the problem by manually removing the caches folder:
rm -rf ~/.npm/_cacache
Or if npm installed in the root folder:
sudo rm -rf /root/.npm/_cacache
npm install --cache /tmp/empty-cache
This is what worked for me
The network caused the module to download the failure
Install a Taobao image and then it's fine:
npm install -g cnpm -- registry-https://registry.npm.taobao.org
cnpm install egg -- save
After trying everything related to npm still the problem persist then it might be caused due to some unwanted cache which are getting deleted in the ".apm" folder.
Follow these steps.
Goto -> C:\Users\Your_Username\.atom\.apm\_cacache
Delete all the files(tmp,content,index etc..)
Again try and install the package by command or atom.
This might work for you. :-)
I've gotten this same error on two different npm packages and haven't seemed to be able to figure it out. I've checked this answer and I don't have any other servers running. I've also tried deleting my module_packages folder, cleaning npm cache clean and then reinstalling using npm i as many threads have suggested, but I still get the same error.
Windows 10 64bit
Node 8.9.4
npm 5.6.0
C:\Users\hunter\Documents\vid>npm install npm install github:storj/node-libstorj --save
> storj#5.1.0 preinstall C:\Users\hunter\Documents\vid\node_modules\storj
> node ./download.js
Unable to download libstorj for platform: win32 and arch: x64
npm WARN vid#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! storj#5.1.0 preinstall: `node ./download.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the storj#5.1.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hunter\AppData\Roaming\npm-cache\_logs\2018-03-25T15_44_06_578Z-debug.log
Any ideas on what might be causing the error would be helpful.
I have good and bad news for you. The good news first: Everythings fine with your computer.
The bad news: The module you would like to install is incompatible with windows operating systems. Have a look at the first line of your error message:
Unable to download libstorj for platform: win32 and arch: x64
There is already an open issue for this problem on GitHub, see: https://github.com/Storj/node-libstorj/issues/43
As mentioned in this issue there are multiple problems:
download/unzip not working
not compiling because some linux-only functions being used (access function)
not linking (it seems nettle and some other link fails)
So you have two options: Wait until this issue gets fixed - or - switch your operating system ;-)
I was getting a "code ELIFECYCLE" error trying to run "usemin" and "imagemin" node-modules via script entries in package.json. These script entries were given in a Coursera "Full Stack Developer" course:
"imagemin": "imagemin img/* -o dist/img/ &&
"usemin": "usemin index.html -d dist -o dist/index.html",
The first line should have read:
"imagemin": "imagemin --out-dir=dist/img/ img/**/*.{png,jpg,git}"
And the issue with usemin giving a "code ELIFECYLE" error was finally traced to the fact that I had installed the API version ("npm install usemin") rather than the cli version ("npm install usemin-cli).
Hope the above helps some other nubbie avoid what now look like an obvious pair of mistakes!
In my application I have a dependency
"sass-loader": "^3.1.1"
I first ran a npm install directly from Windows, but when I tried to run the application it didn't work because the node version is different or something. So it told me to run:
npm rebuild node-sass
I tried to run it from within the container, but then I got an error
npm ERR! code ENOTSUP
npm ERR! errno -95
npm ERR! syscall symlink
npm ERR! nospc ENOTSUP: operation not supported on socket, symlink '../node-sass/bin/node-sass' -> '/usr/src/app/node_modules/.bin/node-sass'
How can I fix this? Is there a way to get around this error and install node-sass?
Currently using:
Windows 10 Pro
Docker 1.11.1-beta10 (build: 2446)
Run the command again with the parameter -no-bin-links
npm rebuild node-sass -no-bin-links
bin-links from NPM docs:
Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems.
I have a fresh installation of laravel 5.1. I followed these steps to Set up Elixir, Bootstrap, Font-awesome etc. When I run npm install it throws an error. I also tried using npm install --no-bin-links as the laravel elixir documentation suggests.
$ npm install --no-bin-links
npm WARN optional dep failed, continuing fsevents#0.3.8
npm WARN optional dep failed, continuing fsevents#0.3.8
> node-sass#3.2.0 install c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js
Binary downloaded and installed at c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-11\binding.node
> node-sass#3.2.0 postinstall c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js
` c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-11\binding.node ` exists.
testing binary.
Binary is fine; exiting.
npm ERR! EEXIST, open 'C:\Users\user\AppData\Roaming\npm-cache\837c67b9-adable-stream-1-0-33-package-tgz.lock'
File exists: C:\Users\user\AppData\Roaming\npm-cache\837c67b9-adable-stream-1-0-33-package-tgz.lock
Move it away, and try again.
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--no-bin-links"
npm ERR! cwd c:\Users\user\PhpstormProjects\my_project
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\user\AppData\Roaming\npm-cache\837c67b9-adable-stream-1-0-33-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! not ok code 0
I searched for the file (that exists) in the npm-cache directory and found there are no such file. But, when I execute the npm command it is created along with hundreds of LOCK file. I tried to delete the file during the installation process (which is quite tricky and seems impossible, because there are a lot of files created and removed simultaneously), which didn't help much. The error is not always the same. Most of the time it says 837c67b9-adable-stream-1-0-
33-package-tgz.lock file exists, some times it's just some other LOCK file.
I also tried updating npm to the latest release: npm -g install npm#latest (sauce)
What helped me on Win 8.1:
Install newest version of Python (3.5 at the moment) and make sure it's on your path (open some command line tool like power shell and enter 'py --version').
npm cache clear
In the laravel installation folder run: npm install --no-bin-links
I was also running power shell as an administrator when issuing the commands, but I'm not sure it matters (won't hurt in this case though).
I faced the same problem and run the terminal as administrator and it solved the problem.
I am not sure about you but issue but now the gulp is working :)
I am trying to make a npm package (plugin) to install the little JS framework through node, have come up with the required package.json as well.
After running the npm link command on Mac terminal, got to see the following errors.
npm ERR! Error: EACCES, symlink '/Repos/GIT/JavaScript-Boilerplate'
npm ERR! { [Error: EACCES, symlink '/Repos/GIT/JavaScript-Boilerplate']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Repos/GIT/JavaScript-Boilerplate' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "link"
npm ERR! cwd /Repos/GIT/JavaScript-Boilerplate
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! path /Repos/GIT/JavaScript-Boilerplate
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, symlink '/Repos/GIT/JavaScript-Boilerplate'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Repos/GIT/JavaScript-Boilerplate/npm-debug.log
npm ERR! not ok code 0
P.S. I am pretty new to nodejs but have strong experience in JavaScript, let me know if you need more detail around.
EDIT - Got to resolved the issues given above but now getting more issues as below:
6495 verbose false,/Repos/GIT/JavaScript-Boilerplate/node_modules,/Repos/GIT/JavaScript-Boilerplate/node_modules/jquery/node_modules unbuild contextify#0.1.5
6496 info postuninstall contextify#0.1.5
6497 verbose about to build /Repos/GIT/JavaScript-Boilerplate/node_modules/jquery
6498 info /Repos/GIT/JavaScript-Boilerplate/node_modules/jquery unbuild
6499 verbose from cache /Repos/GIT/JavaScript-Boilerplate/node_modules/jquery/package.json
6500 info preuninstall jquery#1.8.3
6501 info uninstall jquery#1.8.3
6502 verbose true,/Repos/GIT/JavaScript-Boilerplate/node_modules,/Repos/GIT/JavaScript-Boilerplate/node_modules unbuild jquery#1.8.3
6503 info postuninstall jquery#1.8.3
6504 error contextify#0.1.5 install: `node-gyp rebuild`
6504 error `sh "-c" "node-gyp rebuild"` failed with 1
6505 error Failed at the contextify#0.1.5 install script.
6505 error This is most likely a problem with the contextify package,
6505 error not with npm itself.
6505 error Tell the author that this fails on your system:
6505 error node-gyp rebuild
6505 error You can get their info via:
6505 error npm owner ls contextify
6505 error There is likely additional logging output above.
6506 error System Darwin 12.3.0
6507 error command "node" "/usr/local/bin/npm" "link"
6508 error cwd /Repos/GIT/JavaScript-Boilerplate
6509 error node -v v0.10.4
6510 error npm -v 1.2.18
6511 error code ELIFECYCLE
6512 verbose exit [ 1, true ]
enter code here
enter code here
Looks like I am close to it :)
Permissions you used when installing Node will be required when doing things like writing in your npm directory (npm link, npm install -g, etc.).
You probably ran node installation with root permissions, that's why the global package installation is asking you to be root.
Solution 1: NVM
Don't hack with permissions, install node the right way.
On a development machine, you should not install and run node with root permissions, otherwise things like npm link, npm install -g will need the same permissions.
NVM (Node Version Manager) allows you to install Node without root permissions and also allows you to install many versions of Node to play easily with them.. Perfect for development.
Uninstall Node (root permission will probably be required).
To remove all previously installed npm global modules, see those answers.
Then install NVM following instructions on this page.
Install Node via NVM: nvm install stable
Now npm link, npm install -g will no longer require you to be root.
Solution 2: Install packages globally for a given user
Don't hack with permissions, install npm packages globally the right way.
If you are on OSX or Linux, you can create a user dedicated directory for your global package and setup npm and node to know how to find globally installed packages.
Check out this great article for step by step instructions on installing npm modules globally without sudo.
See also: npm's documentation on Fixing npm permissions.
The easiest way to solve this would be to run the same command again using sudo:
sudo npm link
Please don't change the owner of the /usr/local directory, as this might a) have further implications on installed application and b) might compromise the security on your system. Using sudo is the right way to solve this.
This can be fixed in linux or in my case WSL by setting the global package directory to be in user space rather than root.
First create a dir for global packages
mkdir ~/.npm-packages
Then tell npm where to store globally installed packages
npm config set prefix ~/.npm-packages
Finally ensure npm will find installed binaries and man pages by adding the following to your .bashrc/.zshrc:
NPM_PACKAGES=~/.npm-packages
export PATH="$PATH:$NPM_PACKAGES/bin"
# Preserve MANPATH if you already defined it somewhere in your config.
# Otherwise, fall back to `manpath` so we can inherit from `/etc/manpath`.
export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"