I'm using npm install cmd in my TFS build. I always get the following WARN:
npm WARN optional dep failed, continuing fsevents#0.3.1
How could I delete this warning?
Are you running on Windows or Linux? If so, fsevents cannot be installed, as it is an OSX-only package.
If you run npm with --loglevel=error, you should no longer see this or any other warnings. As far as I know, there is no way to selectively suppress warnings in npm.
The flag -s / --silent works great if you want to remove all warnings and errors:
npm install --silent
npm docs
npm install --no-optional prevents this warning
Related
I recently created a new laravel 8 project using Breeze for the authentication and tailwind css. All worked perfectly when running npm run watch but once I run npm run prod I ran into errors. I noticed that the Tailwind docs mention that there are PostCSS issues so you need to unistall and run
npm install tailwindcss#npm:#tailwindcss/postcss7-compat #tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
I done that however every time I run npm run prod now the build quits at 98% and says
Additional dependencies must be installed. This will only take a moment.
Running: npm install postcss#^8.1 --save-dev --legacy-peer-deps
npm WARN browser-sync-webpack-plugin#2.2.2 requires a peer of webpack#^1 || ^2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
Finished. Please run Mix again.
This auto updates PostCSS to 8.1 every time.
After that if I run npm run prod again it does the exact same message over and over.
I've tried removing the browsersync plugins and trying again but it still doesn't work.
Anyone ran into this or got a solution?
laravel-mix v6 now supports PostCSS8
According to tailwind docs, it suggests to use npm install tailwindcss#npm:#tailwindcss/postcss7-compat #tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
With the new Mix v6, run npm install tailwindcss#latest postcss#latest autoprefixer#latest
After this, npm run prod will run the way it should.
you must upgrade laravel mix using the following command
npm install laravel-mix#latest
As Digvijay mentioned above the new Mix v6 now supports PostCSS 8. So run:
npm install tailwindcss#latest postcss#latest autoprefixer#latest
After the when you run npm run prod you will still get this message:
Additional dependencies must be installed. This will only take a moment.
Running: npm install browser-sync browser-sync-webpack-plugin#2.2.2 --save-dev --legacy-peer-deps
npm WARN browser-sync-webpack-plugin#2.2.2 requires a peer of webpack#^1 || ^2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
Finished. Please run Mix again.
To fix this just add sudo to the front of the npm command it ran:
sudo npm install browser-sync browser-sync-webpack-plugin#2.2.2 --save-dev --legacy-peer-deps
Now run npm run prod and it should work!
For reasons unknown to me, I haven't been able to update to the latest version of npm on macOS (it works fine on Windows). It displays no error, only 'updated 1 package'.
Using Node.js 8.11.1
node -v
v8.11.1
What version of npm do I have?
$ npm -v
5.6.0
I tried this...
$ npm i -g npm
+ npm#5.8.0
updated 1 package in 7.37s
And it fails to update.
$ npm -v
5.6.0
Where is npm?
$ which npm
/usr/local/bin/npm
So I try brew...
brew install npm
And it fails...
$ npm -v
5.6.0
*And then I tried this... *
npm install npm#latest -g
+ npm#5.8.0
updated 1 package in 7.618s
And it fails...
npm -v
5.6.0
With sudo:
sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.794s
And it fails...
npm -v
5.6.0
This also fails...
sudo npm install npm#latest -g
I followed the directions found on this Q&A, completely removing npm and node from my system and reinstalling them from scratch, and it also fails to update.
Screenshot, per request:
Close the terminal, and then re-open the terminal and running:
$ npm -v
5.6.0
sudo twice:
$ sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.478s
$ sudo npm i -g npm
+ npm#5.8.0
updated 1 package in 7.434s
Also fails:
$ npm -v
5.6.0
What did I miss? What's going on here?
This works on my mac.
Based on docs https://docs.npmjs.com/troubleshooting/try-the-latest-stable-version-of-npm :
npm install -g npm#latest
There is a note stated on the docs that depends on your installation method, you might addd some sudo.
Upgrading on *nix (OSX, Linux, etc.)
(You may need to prefix these commands with sudo, especially on Linux,
or OS X if you installed Node using its default installer.)
npm install -g npm#latest
works fine!!
and you can also replace the latest for specific versions
like
npm install -g npm#5.6.0
I hope it will help!!!
Perhaps you have already solved this, but here is what I found when I had exactly this issue. I had 2 versions of npm installed.
I verified this as follows:
grep \"version\" ~/.npm-packages/lib/node_modules/npm/package.json
"version": "6.2.0"
grep \"version\" /usr/local/lib/node_modules/npm/package.json
"version": "5.6.0",
I worked around the issue by updating the path in my bash profile, but would like to know why (how) I ended up with 2 versions. Here is the update:
tail -2 ~/.bash_profile
NPM_PACKAGES="${HOME}/.npm-packages"
PATH="$NPM_PACKAGES/bin:$PATH"
In my case, none of the previous answers worked. For me, a working solution was a simple, five-step process.
Make sure (the old version of) npm is installed.
npm -v
If npm is not installed, then install it on the Mac with Node.js.
Globally installed the desired version of npm.
npm install -g npm#latest
This command uses the old version of npm (installed by Node), to globally install the latest version of npm at ~/.npm-global/. Once installed, close and open a new terminal shell.
Remove the old version of npm installed by Node
rm -r /usr/local/lib/node_modules/npm/
Sometimes this doesn't work, so I had to go into finder to delete the /npm/ folder.
Make sure to set the correct path variable.
echo $PATH
If ~/.npm-global/bin does not show up between the colons, then update the path variable. Open up ~/.zshrc in a text editor and add the following line. If you don't use zsh, open the profile for your corresponding shell (i.e. ~/.bash_profile)
export PATH=$PATH:$HOME/.npm-global/bin
Save your changes and close the text editor.
Close and reopen the terminal shell and run npm -v to check that npm is correctly on the latest version.
The reason for updating the path variable is because the npm cli suggests you update npm with npm install -g npm which will install npm at a different location than where Node installs npm originally.
In my case, only the following has helped:
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --ignore-dependencies node
brew install node
EDIT NOV 21: These days, I bypass brew entirely and use "n":
https://www.npmjs.com/package/n
And so I can change between versions too.
I faced the same problem.
You might have already installed the npm version, and now it is time to point the new npm version install. You can do that by following below steps.
sudo nano /usr/local/lib/node_modules/npm/package.json
change "version" : "5.6.0" to "verison": "5.8.0"
In my case, I'm using nvm to manage different versions of node. In order to upgrade npm version, I have to
1 - Install the latest version of npm by navigating to your current
version of node
cd ~/.nvm/versions/node/v10.9.0
npm install npm
or you can probably use
nvm install-latest-npm
2 - Edit $PATH to point to your current version of node
NPM_PACKAGES="${HOME}/.nvm/versions/node/v10.9.0"
PATH="$NPM_PACKAGES/bin:$PATH"
On my macOS the homebrew-installed npm did not want to upgrade due to pre-existing link file. I ran the install with --force flag and now things are okay.
$ npm --version
6.14.16
$ npm install -g npm#8
npm ERR! EEXIST: file already exists, symlink ...
$ npm install -g --force npm#8
npm WARN using --force I sure hope you know what you are doing.
+ npm#8.19.2
$ npm --version
8.19.2
Note also that in my case, no 'sudo' was required, thanks to homebrew. To check if your npm is installed with homebrew, use brew list.
$ brew list | grep node
node#12
I have problem with puppeteer. I cannot install it on my debian 8.7.1.
These are the steps:
1.install chrome:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get -f install
sudo dpkg -i google-chrome-stable_current_amd64.deb
2.install nodejs & puppeteer:
apt-get install curl
curl -sL https://deb.nodesource.com/setup_8.x | bash -
sudo apt-get install -y nodejs
npm i puppeteer
When I run npm i puppeteer, the errors are:
> puppeteer#0.11.0 install /root/node_modules/puppeteer
> node install.js
ERROR: Failed to download Chromium r499413! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
Error: Download failed: server returned code 403. URL: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/499413 /chrome-linux.zip
at ClientRequest.https.get.response (/root/node_modules/puppeteer/utils/ChromiumDownloader.js:195:21)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:565:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
at TLSSocket.socketOnData (_http_client.js:454:20)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#0.11.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#0.11.0 install 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! /root/.npm/_logs/2017-10-04T12_32_37_607Z-debug.log
I run the command npm config set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true to skip download but it wants to download chromium yet.
Any idea to solve this problem?
Try below options;
1) npm config set puppeteer_skip_chromium_download true
2) Add puppeteer_skip_chromium_download=true to .npmrc file where the package.json location
After that run sudo npm install --unsafe-perm=true --allow-root
References;
https://github.com/GoogleChrome/puppeteer/issues/2270
https://medium.com/forcit/seo-for-single-page-applications-8543619e1d0c
upgrade your puppeteer version (optional)
npm set strict-ssl false
npm config set puppeteer_skip_chromium_download true
and npm install again.
try
sudo npm install puppeteer --unsafe-perm=true
Error: spawn EACCES
This roughly means that puppeteer cannot execute Chrome due to permissions issues. If you're having troubles I have a docker image here that you can use and interact with remotely. The issue with Chrome and many linux distros is that installation is quite a challenge to solve.
If you have chrome already you can use system variable to skip installation
https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables
I faced a similar issue when I was using Puppeteer.
I see two parts to your problem,
1. The inability to download Chromium and getting 403 error other is
2. Error: spawn EACCES problem
I'll start with Error: spawn EACCES problem as it's more subtle and tricky
This is because your debian machine doesn't have the required dependencies installed in order to run Puppeteer. These dependencies differ between distributions(CentOS, Ubuntu/Debian etc...).
Follow these steps,
Install all the dependencies required. You can refer this link for the list, https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
After all the dependencies are installed, install npm and configure proxy in .npmrc if you are behind a VPC/proxy.
Then, as usual, go ahead with npm i puppeteer and proceed as always
Next to address your inability to download Chromium problem.
Are you behind a proxy? That was my issue.
I noticed on executing npm i puppeteer the script downloads Chromium from an external URL which from your log is https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/499413/chrome-linux.zip
npm is unable to download from this external URL because of the proxy blocking it.
The way I solved this issue was by configuring .npmrc file with the proxy settings
npm config set proxy http://<proxy_username>:<proxy_passowrd>#<proxy_host>:<proxy_port>
npm config set https-proxy http://<proxy_username>:<proxy_passowrd>#<proxy_host>:<proxy_port>
Note:
If your username/password contains any special characters you need to URL encode them. Eg. If your username is bruce\wayne then you need to URL encode it as bruce%5Cwayne where %5C="\"
If your proxy has no authentication then ignore and
Examples:
npm config set proxy http://bruce%5Cwayne:darkknight#11.434.2.23:8080
npm config set https-proxy http://bruce%5Cwayne:darkknight#11.434.2.23:8080
So, try configuring your .npmrc file using the commands given above and then try running npm i puppeteer. The proxy will no longer be blocking the external URL and you would be able to download Chromium.
Let me know if this works and reach out to me if you have any doubts.
I have faced similar issue. The best work around for this is to create a project using npm init, then install puppeteer using command "npm install puppeteer --save". This way chromium also gets installed with out any issues.Hope this helps..
Please set the following in .npmrc
puppeteer_download_host = https://npm.taobao.org/mirrors
or
npm config set puppeteer_download_host https://npm.taobao.org/mirrors
I am trying to install Gulp globally on a Windows 7 PC. In a command prompt I ran npm install gulp -gand it ran without any errors, although it did return the following warnings:
npm WARN install Couldn't install optional dependency: Failed to parse json
npm WARN install No data, empty input at 1:1
npm WARN install
npm WARN install ^
When I try to run gulp it says it is not recognized as an internal command.
If I check the %AppData%/npm directory, gulp.cmd is not there. Looking at all the answers to gulp command not found - error after installing gulp, I take it this is where it should be.
Any ideas what has gone wrong, or where I can look to see what has gone wrong?
When I tried to do a local install of gulp: npm install gulp, it actually showed an error:
Failed to Parse json... File:
C:\Users\username|AppData\Roaming\npm-cache\clone\1.0.2\package\package.json
When I deleted this file and retried the Global install, it then worked.
I'm trying to install docpad and following the guide on: http://docpad.org/docs/install
When I issue the command:
npm install -g docpad#6.63
I get the following npm error:
npm ERR! Error: No compatible version found: taskgroup#'~3.3.7n'
npm ERR! Valid install targets:
npm ERR! ["2.0.0","3.0.0","3.1.0","3.1.1","3.1.2","3.2.0","3.2.2","3.2.3","3.2.4","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.3.8"]
My node version: v0.10.15
My npm version: 1.2.18
I'm running Kubuntu 13.10 with all updates.
I checked if there is an issue reported for this on github, there isn't. Should I report this as an issue or am I doing something wrong?
Same problem here (Kubuntu 13.10).
I sugggest to go back to a previous version of docpad for the moment. On Ubunto/Debian there is another pitfall: some node modules depend on the nodejs executable to be available under node, so you need the additional package nodejs-legacy.
This worked for me:
sudo apt-get install nodejs-legacy
npm install docpad#6.55.6
Bug on DocPad's behalf, that n shouldn't have been there. Now fixed in v6.63.5. Thanks for the report!