简体   繁体   English

全局 NPM package 未安装

[英]Global NPM package not installing

I have written a command line utility in JS which can be used to backup data to IPFS.我在 JS 中编写了一个命令行实用程序,可用于将数据备份到 IPFS。

https://www.npmjs.com/package/ipfs-backup https://www.npmjs.com/package/ipfs-backup

When I am attempting to install it with npm install -g ipfs-backup I am getting an error which prevents the package from being installed.当我尝试使用npm install -g ipfs-backup安装它时,出现错误,导致无法安装 package。

The terminal is outputting the following:终端正在输出以下内容:

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path C:\Users\jwhit\AppData\Roaming\npm\node_modules\ipfs-backup\node index.js
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\Users\jwhit\AppData\Roaming\npm\node_modules\ipfs-backup\node index.js'
npm ERR! enoent This is related to npm not being able to find a file.

The issue turned out to be that within my package.json file I had问题原来是在我的 package.json 文件中

"bin": {
    "ipfs-backup": "node index.js",
    "ipfs-restore": "node restore.js"
}

instead of代替

"bin": {
    "ipfs-backup": "./index.js",
    "ipfs-restore": "./restore.js"
}

It installs and functions correctly now.它现在可以正确安装和运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM