首页 > 解决方案 > 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.

I've tried to 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. 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)

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.

标签: node.jsnpmnpm-install

解决方案


确保您在正确的路径中运行此命令并尝试运行这样的命令 - npm install libraryName -g


推荐阅读