In this post, we will look into some of the NPM Basic Error Code. These error codes we will get irrespective of any operating system we use.
Lack of right Permission during npm install causes EPERM and EACCES issue.
npm ERR! code EPERM
npm ERR! code EACCES
EPERM & EACCES, First time while installing packages globally most of us will get this error and to fix this error please make sure of having to write permission for the npm cache folder.
While installing packages globally, Please make sure you are using sudo in case of mac or Linux based operating system and in windows machine try to install as an administrator or with elevated privilege.
No Such File or Directory
Lack of files in the folders or lack of node configuration files and other related files will cause ENOENT issue.
npm ERR! code ENOENT
To fix this error please make sure all the files are available in the location and make sure files got write access for the specific user Id.
Lack of space in the drive or lack of write permission will cause ENOSPC issue.
npm ERR! code ENOSPC
To fix this error, please make sure your file system got enough space and make sure you got right permissions on that file system.
Free some disk space.
The absence of git executable in the system will cause ENOGIT issue.
npm ERR! not found: git ENOGIT
All the node packages are maintained in git and all packages are pulled to local machine using git via npm.
The only solution to this problem is installing Git on your local machine.
Some of the other errors we will get with npm are
- SSL Error
- SSL Error: CERT_UNTRUSTED
- SSL Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
- SSL Error: SELF_SIGNED_CERT_IN_CHAIN
- Not found / Server error
- Invalid JSON
SSL Errors occur mostly in lower versions of node and in higher versions, you won’t run into these issues and other issues are might be due to packages you are installing, so make sure you are installing right packages.
Please share if you are getting any more error with npm in the comment section. If you like it, Please share it with your social network friends and fellow developers.
Originally published at nodesimplified.com on December 19, 2017.