I'm trying to run npm install, this is output from console:
npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! Maximum call stack size exceeded
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
and this is content of npm-debug.log:
113791 verbose stack RangeError: Maximum call stack size exceeded
113791 verbose stack at Object.color (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/console-control-strings/index.js:115:32)
113791 verbose stack at EventEmitter.log._format (/usr/lib/node_modules/npm/node_modules/npmlog/log.js:252:51)
113791 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/log.js:138:24)
113791 verbose stack at emitThree (events.js:116:13)
113791 verbose stack at emit (events.js:194:7)
113791 verbose stack at .<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js:23:18)
113791 verbose stack at emitThree (events.js:116:13)
113791 verbose stack at emit (events.js:194:7)
113791 verbose stack at .<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js:23:18)
113791 verbose stack at emitThree (events.js:116:13)
113791 verbose stack at emit (events.js:194:7)
113792 verbose cwd /home/giorgi/AdMove/dev/web-advertiser-admove
113793 error Linux 4.8.0-27-generic
113794 error argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
113795 error node v6.9.1
113796 error npm v3.10.8
113797 error Maximum call stack size exceeded
113798 error If you need help, you may report this error at:
113798 error <https://github.com/npm/npm/issues>
113799 verbose exit [ 1, true ]
Removed node_modules several times and tried to reinstall. Can't understand what's the reason that causes this and how to fix it.
metzelder's answer helped me fix the issue. however if you run the command npm cache clean, it will give you a message
As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid
So, as of npm5 you can do by adding a --force flag to the command.
So the command is:
npm cache clean --force
npm rebuild
it has solved my problem
Try removing package-lock.json and the node_modules folder:
rm package-lock.json
rm -r node_modules
I had the same issue with npm install.
After a lot of search, I found out that removing your .npmrc file or its content (found at %USERPROFILE%/.npmrc), will solve this issue. This worked for me.
npm uninstall
npm cache clean --force
I tried these two methods but they didn't work. After, I deleted the node_modules directory and ran npm install again, it still didn't work. Lastly, I deleted package-lock.json and created a new package-lock.json file using
npm install
I have overcome this issue by doing following:
Delete all the content of the npm dependencies. You can find the default install location according to this thread:
https://stackoverflow.com/a/5926706/1850297
Before you run npm install command, I suggest to run npm cache clean --force
npm rebuild will work for sure
In my case, update to the newest version:
npm install -g npm
I deleted
node_modules
and then reinstalled by
npm install
It worked for me
I have also faced the same problem and this is how i resolved it.
First of all you need to make sure that your node and npm versions are up to date. if not please upgrade your node and npm packages to latest versions.
nvm install 12.18.3 // update node version through node version manager
npm install npm // update your npm version to latest
Delete your node_modules folder and package-lock.json file.
Force clean the entire NPM cache by using following comand.
npm cache clean --force
Re-Install all the dependencies.
npm install
If above step didn't resolve your problem, try to re-install your dependencies after executing following command.
npm rebuild
This issue can also happen if you're trying to install a package that doesn't exist or if you're trying to install a version that doesn't exist.
npm cache clean returns below message
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. On the other hand, if you're debugging an issue with the installer, you can use npm install --cache /tmp/empty-cache to use a temporary cache instead of nuking the actual one.
If you run npm cache verify, as specified above, then it actually runs cache verification and garbage collection which fixes the problem.
Cache verified and compressed (~\AppData\Roaming\npm-cache_cacache):
Content verified: 6183 (447214684 bytes) Content garbage-collected: 16
(653745 bytes) Index entries: 9633
Happened in docker (node:15-buster) for me.
Remember to use WORKDIR /<folder> so that it doesn't conflict with original npm libraries installed.
The folder can be anything but system folders, so that includes using /.
In case none of these answer work for you, it may be because the terminal you're using isn't the right one/ your node_modules is used by another part of your computer.
In my case I kept juggling between this error (maximum call stack size exceeded) and the access error event when I did a sudo npm i.
The fix was to close my IDE (which was WebStorm), run npm i in a basic terminal, and that was it.
I'm not a Windows user, so if you are, try to check Rene Knop comment.
For Unix/OSX users, I've removed the root .npmrc file ~/.npmrc.
Before you're going to try it, please,
check if there is nothing necessary over there
you can use this command to bring all content into your terminal: cat ~/.npmrc .
If you have got something like:
cat: /Users/$USER/.npmrc: No such file or directory
to save a copy:
cp ~/.npmrc ~/.npmrc_copy
Now, try to remove it (Works for bash users: Unix / Ubuntu / OSX ...):
rm -f ~/.npmrc
This worked for me.
Hope this will be helpful for others.
I also had the same problem. I had tried the previous solutions, but the solution for me was much simpler. I only had to remove the space in the directory and then run npm i again
Thanks to: https://github.com/nodejs/node-gyp/issues/809#issuecomment-155019383 for pointing this out.
In my case I had a custom .npmrc file that included an auth token for authenticating with a private npm registry.
The token had expired, which helpfully returned code E401: Incorrect or missing password locally, but ERR! Maximum call stack size exceeded from the CI build.
You uninstall npm package and force clean the cache and close terminal and reinstall whichever package be.
$sudo npm uninstall <package - name>
$sudo npm cache clean --force
Then restart terminal and check
Still not working upgrade both npm and node to the latest version
Today we encountered this error when running an npm prune even after running an npm cache clean --force.
Versions:
node 13.8.0
npm 6.13.6
Deleting the package-lock.json worked for this case as well. Thank you all!
In general, once a module has been installed, it's much more convenient to use npm ci instead of npm install. Please check out this SO answer for the advantages of the former with respect to the later in a production environment.
So please just run
npm ci
All dependencies will be updated, and the problem will disappear. Or it will error in the case there's some grave de-synchronization between one and the other.
Most of the times, this issue occurs if you are using the system provided by the organization you work for and it's vpn restricts the use of this command.
In this case, you may try to disconnect from organization vpn and then execute this command.
I tried everything to fix this issue on my Mac. I think the issue started when I had already downloaded npm from Node.js and then reinstalled it with Homebrew while following along with a Team Treehouse video.
Here's what I tried:
From https://docs.npmjs.com/misc/removing-npm
sudo npm uninstall npm -g
sudo make uninstall
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
From How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
Here's what worked:
In the end, the only thing that worked for me was to clone down the npm-reinstall repo from GitHub that completely removed everything related to npm on my Mac.
https://github.com/brock/node-reinstall
I then had to reinstall node and npm from Node.js.
I tried everything to fix this issue on my windows 7 machine like
Reinstalling and rebuilding npm
At last, I fixed this small configuration setting issue by wasting my entire day.
How I resolved this issue
Removing my project specific configurations in global .npmrc
at location like drive:/Windows/Users/../.npmrc
I solved it 100% I had this problem with gulp version: 3.5.6.
You should clean the package-lock.js and then run npm install and It worked form
Our company dev environment uses Artifactory as the default registry for our NPM dependencies, and when running npm install it was defaulting to this, which did not work... so manually specifying the main npm registry via npm install --registry https://registry.npmjs.org fixed this issue for me...
I was facing the same error, I was trying to install jest into to one of the packages in a monorepo project.
If you are using Yarn + Learna to package a monorepo project, you will have to navigate to the package.json inside the target package and then run npm install or npm install <package name>.
I don't know why, but I ran npm install with sudo and it worked.
sudo npm install
I had this problem and it was due to an upgrade of my git executable. I rolled back to Git-2.21.0.rc1.windows.1-64-bit and added this to my environment path and it fixed my issue.
The one thing that finally worked for me on Mac was upgrading from node 8.12 to 10.x using NVM.
I uninstalled all other versions of Node with NVM, then installed 10.x, then ran nvm alias default node, which tells NVM to always default to the latest available node version on a shell.
After that, my live reloading issue went away!
Switching to yarn solved the issue for me.
Related
As the title says, I cannot run create-react-app.
You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
Doing this does not change the error. npm uninstall -g create-react-app
I entered this command to try it out and got a message that the tar was out of date.
npm install -g create-react-app
npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code EEXIST
npm ERR! path /opt/homebrew/bin/create-react-app
npm ERR! EEXIST: file already exists
npm ERR! File exists: /opt/homebrew/bin/create-react-app
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
https://www.npmjs.com/package/tar
I ran the command with this reference.
However, the tar was not updated.
I have already tried all the published solutions, but they don't work. Can someone please help me? Please.
I tried clearing the cache but could not solve the problem.
npx clear-npx-cache
Need to install the following packages:
clear-npx-cache
Ok to proceed? (y) y
I was able to successfully run the following command by specifying the version each time, but it is a hassle and I want to be able to run it normally.
npx create-react-app#latest my-app
The "fish" shell I am currently using is node v18.0.0, so I downgraded to v16.15.0 and it works fine.
fisher install jorgebucaran/nvm.fish
nvm install v16
I had forgotten to lower the node version in fish because it had been working fine with zsh.
When I was trying to create a new react app using npx create-react-app example_app, I get this error
[Your cache folder contains root-owned files, due to a bug in previous
versions of npm which has since been addressed sudo chown -R 0:0
"/root/.npm"]
I even tried to re-install create-react-app again using npm i create-react-app, it is giving the same kind of
error.
I assume after searching about it that it is due to some permissions issue. My current user doesn't have permission to /home/shubham/.npm where shubham is my username, but I am not so sure about this.
I have tried to solve this error using chown command as
sudo chown -R <username>:<groupname> /home/shubham/.npm"
where <username> is Shubham and <groupame> is 1000, but it is still not working.
Request people to help me out.
If you need any more information, let me know.
This worked for me:
sudo npm cache clean --force
This is what helped me after going through the above answers. I hope it helps someone else too. After re-reading the npm error prompt, I adjusted the provided command to include the .npm path given in the error message. Below is a copy of my original error messages.
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /home/vagrant/.npm-global/lib/node_modules
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 900:900 "/home/vagrant/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2020-07-09T16_43_35_046Z-debug.log
[ExecStack] Exit code 243 Time 01:03
[error] Executing target-hook frontend-reqs failed.
[error] Command source:build:frontend-reqs exited with code 1.
Instead of using sudo chown -R 900:900 "/home/vagrant/.npm", I used sudo chown -R 900:900 "/home/vagrant/.npm-global". After that, I was able to use the previous command that caused the error with no issues.
Set the npm_config_cache environment variable
in linux
export npm_config_cache=/path/to/cache
in windows
set npm_config_cache=/path/to/cache
Try sudo chown -R 1000:1000 "/home/shubham/.npm"
I had to do both the root folder and the root/.npm
sudo chown -R 1001:1001 "/root"
sudo chown -R 1001:1001 "/root/.npm"
If you are using CI and share the CI slave with other teams, maybe not possible to sudo chown -R {group}:{user} "~/.npm" (i.e.: using Github Enterprise with Github Actions on shared runners
I add
# use local cache to work-around 'npm ERR! path ~/.npm/_locks/staging-xxx.lock' in GHA
cache=./npm-cache
into my .npmrc in the repo to solve the issue by using local npm cache dir
I had the same issue and several others while trying to update my npm packages. I will be honest I do not have enough knowledge of package handlers or why this fixed my situation, but I believe my version of npm and npx were causing the issues. I had errors immediately trying to install npx, node and create-react-app with my old and out of date version of npm.
I could not run npm install npx -g without --force. Once I did that I also ran npm install npm -g --force. After this I could already tell things were different.
After npm and npx were completely overwritten, I ran npm install node -g and npm install create-react-app -g without any weird problems. I created a new react app and started it error free.
(I also ran the cache command before all of this. sudo npm cache clean --force which I am unsure if it helped).
I was getting this while running npx #11ty/eleventy as root:
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 1000:1000 "/root/.npm"
No, /root/.npm is supposed to be owned by root. It's not at all due to a bug in a previous version of npm. And yes, the root user has permission to read and write that directory. So this is a bug in the current version of npm that prevents building the project as root.
Of course following the nonsensical instructions to change the root homedir's ownership does not work.
In my case, I was running it as root as part of a build script that needs root for an rsync to complete:
#!/bin/bash -eu
# mybuildscript
npx #11ty/eleventy
rsync _site/ /srv/www/ # This needs to be run as root
So my workaround was to run that single line as an unprivileged user using sudo:
#!/bin/bash -eu
# mybuildscript
sudo -u ki9 npx #11ty/eleventy
rsync _site/ /srv/www/ # This needs to be run as root
I am using npm version 7.5.2. Hopefully this will be addressed in a future version of npm.
I also tried all of the above steps on my MAC Catalina, but didn't resolve my issue. These steps resolved my problem:
npm update
npx --ignore-existing create-react-app my-app
Thanks to this comment
This will work:
sudo chown -R 1000:1000 "~/.npm"
Neither force-cleaning the cache nor using chown worked for me, but deleting the folder did work and fixed the issue.
My error was:
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/aw/.npm"
The fix was to permanently erase the .npm folder in question, which I did using rm -rf:
sudo rm -rf /Users/aw/.npm
(Mandatory warning: this is a dangerous command if you typo it.)
I encountered the same issue and the problem with mine was that I was running an older version of npm. After updating npm and removing the .npmrc file, it worked just fine.
npm install -g npm#latest
rm .npmrc
Be careful before deleting the .npmrc file, take a backup as it will reset your npm configuration.
I fixed mine by running:
sudo npm cache clean --force
followed by removing the root owned files.
first, to view the file owners and group:
cd /Users/username/
ls -la
You have to check the owner of .npm, changed to non-root user:
sudo chown -R username:group "/Users/username/.npm"
or for global .npm-global
sudo chown -R username:group "/Users/username/.npm-global"
replace keyword: username/group accordingly
It helped me:
Remove and install npm again
It work for me now!
What I did? (I'm not saying it's the best way to fix this but i'ts working for me. I'm still looking for the best explications for this issue)
sudo rm -Rf /home/[YOUR_USER_NAME]/.npm-global/lib/node_modules/
and run your command again.
My explication is that it seems like something is corrupted in the node_modules's folder.
As it's not risky to delete it I did it and it works now.
Try sudo npx create-react-app example_app or in my case sudo npm install #vue/cli
I tried everything else here, but in the end realised that it might just be the command that I was running was not able to escalate the correct permissions.
Find error in your log file:
verbose Error: EACCES: permission denied, mkdir '/Users/xxx/.tnpm_tmp/npm-52731-e91f6671'
Use that error in your condition.
sudo chown -R 502:20 "/Users/XXX/.tnpm_tmp"
I solve the problem with the following commands
Install dependence > npm install create-react-app
run > create-react-app project_name
happy hack!!
Try to create your react app using yarn package manager.
I am using reactjs and am unable to install any packages using npm install. The error message I'm getting is :
npm ERR! Cannot read property 'resolve' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /home/stash/.npm/_logs/2019-03-11T10_07_30_264Z-debug.log
When I do npm install -verbose:
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '-verbose' ]
npm info using npm#6.7.0
npm info using node#v11.10.1
npm verb npm-session 869376d36eca27b5
npm info lifecycle proj-lite#1.0.0-alpha.6~preinstall: proj-lite#1.0.0-alpha.6
npm timing stage:loadCurrentTree Completed in 22ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1231ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 2661ms
npm verb stack TypeError: Cannot read property 'resolve' of undefined
npm verb stack at regFetch (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/index.js:76:23)
npm verb stack at fetchPackument (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/packument.js:42:10)
npm verb stack at packument (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/packument.js:20:10)
npm verb stack at getManifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:22:10)
npm verb stack at manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:13:10)
npm verb stack at Object.manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/index.js:17:12)
npm verb stack at Object.Fetcher#manifest [as manifest] (/usr/local/lib/node_modules/npm/node_modules/genfun/lib/genfun.js:15:38)
npm verb stack at manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetch.js:23:18)
npm verb stack at pinflight (/usr/local/lib/node_modules/npm/node_modules/pacote/manifest.js:24:12)
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:29:24
npm verb stack at Promise._execute (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/debuggability.js:313:9)
npm verb stack at Promise._resolveFromExecutor (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:483:18)
npm verb stack at new Promise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:79:10)
npm verb stack at _inflight (/usr/local/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:28:25)
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:22:14
npm verb stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm verb cwd /var/www/html/lite-proj/lite-proj
npm verb Linux 4.4.0-142-generic
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-verbose"
npm verb node v11.10.1
npm verb npm v6.7.0
npm ERR! Cannot read property 'resolve' of undefined
npm verb exit [ 1, true ]
npm timing npm Completed in 3862ms
npm ERR! A complete log of this run can be found in:
npm ERR! /home/stash/.npm/_logs/2019-03-11T10_12_15_921Z-debug.log
I am not even able to uninstall npm and reinstall it as I am getting the same error when I try to uninstall. What is the issue here and how do I fix it?
I got into this situation with an old version of the n node version switcher (~v2), having switched onto Node v12. I was able to fix it by switching to a much older version of Node it had installed using n, v8 worked for me, and then upgrade the version switcher with sudo npm install -g n.
From there I could switch to any version of node and use npm again.
The reason for the error was probably conflicting global packages and node versions. I uninstalled node and npm and then reinstalled them.
To remove nodejs and associated packages (like npm):
sudo apt-get purge --auto-remove nodejs
Nodejs and npm will leave files in the system which may cause issues during reinstallation. I had to remove them as well.
Although it is a bad practice to remove packages manually (it may cause problems with the package manager), it helped my case. This answer shows how to remove nodejs and related files manually.
To reinstall them:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
So I have recently faced a very similar problem when I was trying to run a react project in my Windows 10 x64 PC. Although I installed Node.js v12.13.0 (+ npm v6.12.0) x64; I couldn't execute npm install command, as it would give me this same error (Cannot read property 'resolve' of undefined).
Then according to this comment, I uninstalled the x64 version of Node.js and then installed the x86 version. After this, I could execute the npm install command successfully.
Anyone having this issue and have scrolled this far, if you are installing node manually and you have nvm installed then this might be the issue, don't do it manually, and don't uninstall nvm to fix the issue, just let nvm install the version for you rather than doing it manually, if you don't have nvm installed and you are lost trying upgrading/downgrading node/npm versions, then install nvm and let it handle all these things for you.
Use nvm install x.x.x, then nvm use x.x.x, and everything worked just fine.
more about nvm
The problem may occur if you are using node version manager(nvm) try uninstalling it , i had the same issue and i uninstalled nvm and tried it .
Worked with all versions of node . (worked fine with node 10.15.3,10.16 and 12.7)
I installed Node sometime ago (approximately 1 year ago) and npm worked properly.
The node version was 10.15.3. After the install and having written a few small apps - I did not work with Node again until today. Trying to install express with npm - I got the error of: "npm ERR! Cannot read property 'resolve' of undefined" even though it had worked previously.
Noting that the Node version was old, I uninstalled and installed the latest version.
In my case, I installed into the c:\NodeJs folder (where it was installed previously).
This made no difference - I got the same error.
I then uninstalled and re-installed into the default folder of c:\Program Files\nodejs and npm works again. Hopefully this might help someone else
I encountered the same issue on Windows 10.
After uninstalling node and reinstalling a newer version, I got the error "Cannot read property 'resolve' of undefined".
I then uninstalled again, manually deleted the complete installation folder (which was not removed during uninstallation !) and reinstalled the newer node release.
After that, everything worked just fine.
The same issue occurred for me on FreeBSD after I tried to update a really outdated node installation.
After removing node and npm packages (pkg delete node8-8.16.2) I had to manually remove /usr/local/lib/node_modules directory (some npm dependencies had been left behind and that caused the problem).
Instead of version 12.18.3 install version https://nodejs.org/dist/v10.15.3/node-v10.15.3-x64.msi . It will work perfectly.
There is some issue with the new node version and npm compatibility, install version [https://nodejs.org/dist/v10.15.3/node-v10.15.3-x64.msi] It will work perfectly.
I am trying to create a new react-app and start it, I have created react apps before with no errors but this time when i npm start i get this error
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix
locally.
The react-scripts package provided by Create React App requires a
dependency:
"webpack-dev-server": "3.1.14"
Don't try to install it manually: your package manager does it
automatically.
However, a different version of webpack-dev-server was detected higher up
in the tree:
C:\Users\ashraf\node_modules\webpack-dev-server (version: 3.1.9)
Manually installing incompatible versions is known to cause hard-to-debug
issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to
an .env file in your project.
That will permanently disable this message but you might encounter other
issues.
To fix the dependency tree, try following the steps below in the exact
order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your
project folder.
2. Delete node_modules in your project folder.
3. Remove "webpack-dev-server" from dependencies and/or devDependencies in
the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the
above steps with it instead.
This may help because npm has known issues with package hoisting which may
get resolved in future versions.
6. Check if C:\Users\ashraf\node_modules\webpack-dev-server is outside
your project directory.
For example, you might have accidentally installed something in your home
folder.
7. Try running npm ls webpack-dev-server in your project folder.
This will tell you which other package (apart from the expected react-
scripts) installed webpack-dev-server.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in
your project.
That would permanently disable this preflight check in case you want to
proceed anyway.
P.S. We know this message is long but please read the steps above :-) We
hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! learnreact#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the learnreact#0.1.0 start 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\ashraf\AppData\Roaming\npm-cache\_logs\2019-02-
04T20_36_39_924Z-debug.log
PS C:\Users\ashraf\Desktop\Files\LearnReact\learnreact>
i have tried all the steps in detail in the error log but its still not working, any thoughts on what is causing this error? Thanks in advance
It seems like you want to depend on webpack-dev-server inside your local project.
Perhaps you need to run npm install in your project, instead of your ~ home directory?
from your output, notice these lines.
However, a different version of webpack-dev-server was detected higher up
in the tree:
C:\Users\ashraf\node_modules\webpack-dev-server (version: 3.1.9)
...
6. Check if C:\Users\ashraf\node_modules\webpack-dev-server is outside
your project directory.
For example, you might have accidentally installed something in your home
folder.
so I would
cd ./my-project
npm i
Did you install webpack-dev-server on its own? It seems it has been installed either by you or by another project install. Webpack is for your local development environment so the other install is close enough to your project to interfere with the copy that react is trying to install in your project folder. Steps 1-4 in your error message should resolve your issue. If you have done that and its still not working, did you get different error messages with your next attempt to install your react package?
I have faced the same issue and this method worked for me.
Do follow the steps:
Start terminal from the desktop and write this command:
npm uninstall webpack-dev-server
This will uninstall webpack-dev-server package globally from you node modules.
Go back to you the terminal of your project and install webpack-dev-server package:
npm install webpack-dev-server#version
Note: The version part (above) should equal the versions asked for in the error message.
npm install webpack-dev-server
Now start npm:
npm start
This error mostly occurs when you have created your project using the
npx create-react-app command instead of the npm create-react-app command.
I am trying to use Node.js imagemin to compress a lot of images on my server. I like using imagemin because I know how to point it at specific directories.
I am using CentOS 6 and when I run my file, I get the error:
node_modules/imagemin/node_modules/imagemin-pngquant/node_modules/pngquant-bin/vendor/pngquant: /lib64/libc.so.6: version `GLIBC_2.14' not found
Also, when I installed imagemin with npm install imagemin, I got an error that said:
Error: pngquant failed to build, make sure that libpng-dev is installed
Any ideas on what I can do to solve this?
(Problem de facto already solved in the comments - but for the sake of completion and future generations I'm posting an actual answer).
Error: pngquant failed to build, make sure that libpng-dev is installed
This error means that the system is lacking libpng development library, which is needed to install imagemin Node.JS module. To install it on CentOS 6, you need to issue this command:
yum install libpng-devel
Please note that both package manager (here - yum) and package name (libpng-devel) can vary between different Linux distributions.
I had the same issue with CentOS 7 even with libpng-devel installed. It seems the package carries a precompiled binary program in node_modules/pngquant-bin/vendor/pngquant which is somehow incompatible with the Linux installation (CentOS 7 latest).
I have made a solution to the problem by replacing this binary file with the one that is available for CentOS 7.
I am installing the official package pngquant with yum, first. Then I am installing the node modules. You can remove the node_modules folder if you like prior to install action. Its not required, though.
The error will be shown as usual (the program file is not yet replaced):
⚠ The `node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
⚠ pngquant pre-build test failed
ℹ compiling from source
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
However, after replacing the binary file everything should be fine.
sh
yum install libpng-devel pngquant
npm install
rm -rf node_modules/pngquant-bin/vendor/pngquant
ln -s /usr/bin/pngquant node_modules/pngquant-bin/vendor/pngquant
After that you can run any command you like, "imagemin:dynamic", etc. It should work properly.
Summary
Generally speaking, the problem appear to be inside the pngquant-bin node package. This solution might help for other Linux distributions as well.
The solution itself is to install the officially supported version of pngquant with the OS package manager and to replace the binary inside the pngquant-bin vendor folder after its installation.
Update
In addition, there is a recent problem that is still related with pngquant npm package. It seems that there is a buggy release of it - lock the required pngquant package in your package.json to older version (last properly running version for you).
The previous solutions didn't work for me. I'm using centos 7.4
When executing executing
# npm install
I recieved the error:
✖ Error: pngquant failed to build, make sure that libpng-dev is installed`
While trying to install libpng-devel, it says it's already installed.
Solution
Update the nodejs & npm version if it's using old one.
I have updated to
Nodejs Version
[root#hosting ~]# node -v
v8.10.0
npm version
[root#hosting ~]# npm -v
5.7.1
Check the installed libpng-devel on your server.
[root#hosting ~]# rpm -qa |grep libpng
libpng-1.5.13-7.el7_2.x86_64
libpng-devel-1.5.13-7.el7_2.x86_64
If you are using epel repo then it will install the latest version. For more libpng release check
[root#hosting ~]# yum list |grep libpng
I have installed
yum install libpng12-1.2.50-10.el7.x86_64 libpng12-devel-1.2.50-10.el7.x86_64
moved node modules
mv node_modules node_modules_bak
Then type
# npm install
in my case, I'm using a CentOS instance on Amazon WS and I faced same problem here. I solved it by installing libpng12 and libpng12-devel (yum install libpng12 libpng12-devel), then running yarn install (or npm install) and the packages did installed correctly.
Just this!
Here's how I resolved the issue for my case:
Delete node_modules:
rm -rf node_modules
Install following dependencies:
sudo dnf install libpng-devel pngquant gcc make libpng12 libpng12-devel
Rebuild dependencies. I use yarn:
yarn