如何无误安装Express?

5

我正在为一个项目安装express,但是当我运行npm i express命令时,出现了以下错误:

npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../mime/cli.js
npm ERR! dest /media/pi/HMMM/Programming/nodejs/myFirstHTTPS/node_modules/.bin/mime
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/media/pi/HMMM/Programming/nodejs/myFirstHTTPS/node_modules/.bin/mime'
npm ERR!  [Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/media/pi/HMMM/Programming/nodejs/myFirstHTTPS/node_modules/.bin/mime'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../mime/cli.js',
npm ERR!   dest: '/media/pi/HMMM/Programming/nodejs/myFirstHTTPS/node_modules/.bin/mime'
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:
npm ERR!     /home/pi/.npm/_logs/2021-12-31T21_49_55_020Z-debug.log

我正在树莓派4上运行最新版本的树莓派操作系统,使用Node和NPM。请解释一下出了什么问题以及如何解决。
2个回答

7

看起来你正在尝试安装到SD卡或USB驱动器上,我假设这是格式化为FAT32的。不幸的是,FAT32不支持符号链接。

你可以尝试这个:

npm install --no-bin-links express

如果那不起作用的话,你将需要使用一个非FAT32文件系统。


1

似乎是权限问题。

如果您使用的是Mac,请运行:

sudo npm install express

如果你使用的是Windows操作系统,我不确定相应的等效方法,但你需要以管理员身份运行。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接