简体   繁体   English

NPM 全局安装当前应用程序(例如 npm install -g。)

[英]NPM install current application globally (e.g. npm install -g .)

I am working on a package that is mean to be used globally and I want to install it globally before publishing it.我正在开发一个 package,它意味着要在全球范围内使用,我想在发布之前在全球范围内安装它。

I've tried to use npm i -g.我尝试use npm i -g. but it always fails due to files not being found但由于找不到文件,它总是失败

npm ERR! code ENOENT
npm ERR! syscall access
npm ERR! path /home/ivan/lux2/cli/node_modules/file-uri-to-path
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, access '/home/ivan/lux2/cli/node_modules/file-uri-to-path'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ivan/.npm/_logs/2020-04-29T01_38_22_536Z-debug.log

I've tried this on a couple of different global npm package I'm working on all have the same result.我已经在几个不同的全球 npm package 上进行了尝试,我正在研究的结果都相同。 I created a new package and it did work, is it something weird about the failing module (I've also seen bindings, nan and fsevents with this same error)我创建了一个新的 package 并且它确实有效,失败的模块是否有些奇怪(我也看到了具有相同错误的绑定、nan 和 fsevents)

If I try creating those directories (they are not in my dependencies) I just end up finding more missing directories.如果我尝试创建这些目录(它们不在我的依赖项中),我最终会发现更多丢失的目录。

Any help would be appreciated.任何帮助,将不胜感激。

Make sure you are running this command in a correct path and try to run command like this - npm install libraryName -g确保您在正确的路径中运行此命令并尝试运行这样的命令 - npm install libraryName -g

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

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