How to solve 'npm ERR! syscall symlink' error
Solution for error: npm ERR! code EPERM npm ERR! syscall symlink When running 'npm install'
Today I copied a Node.JS project from one hard disk to another one and when importing the project into Visual Studio Code and running npm install
I encountered this error:
[terminator@skynet cli-tool-x]$ npm install
npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../@babel/parser/bin/babel-parser.js
npm ERR! dest /run/media/terminator/STORAGE/Codes/NodeJS/cli-tool-x/node_modules/.bin/parser
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/run/media/terminator/STORAGE/Codes/NodeJS/cli-tool-x/node_modules/.bin/parser'
npm ERR! [Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/run/media/terminator/STORAGE/Codes/NodeJS/cli-tool-x/node_modules/.bin/parser'] {
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../@babel/parser/bin/babel-parser.js',
npm ERR! dest: '/run/media/terminator/STORAGE/Codes/NodeJS/cli-tool-x/node_modules/.bin/parser'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in: /home/terminator/.npm/_logs/2023-07-13T22_01_26_995Z-debug-0.log
Which seemed weird to me because with the other disk it worked perfectly in the same computer. But welcome the fucking world of computing I guess. I tried several times to run the same command as root
user but other problems came up. In the end I googled it and found out that I could also use this command:
npm install --no-bin-links
Since the problem comes when npm
creates symbolic links then we just indicate that we don't want that to happen. So here's the result:
[terminator@skynet cli-tool-x]$ npm install --no-bin-links
added 283 packages, and audited 284 packages in 6s
31 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Problem solved, but honestly fuck that shit! Why can't things just work well even when hard disks are different?
Well, enough ranting for today, it works, I am happy.