node.js - 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.
解决方案
确保您在正确的路径中运行此命令并尝试运行这样的命令 - npm install libraryName -g
推荐阅读
- react-native - 运行 onpress 功能时出现问题:反应导航
- reactjs - 检查一个元素是否在 React 的中心
- oracle - 无法将此 SQL 查询转换为 PL/SQL
- javascript - 如何在 React Native 中使用带有可滚动屏幕的 React Native swiper
- javascript - 在绑定方法中获取类的 this 上下文,同时保留绑定 this
- typescript - TypeScript 命名空间要停止使用?
- python-3.x - 为每个元素生成具有唯一范围的 numpy 矩阵
- sql-server - 将今天的日期附加到 sp_spaceUsed 的结果中
- python-3.x - 如何在不同的分辨率下使用经过训练的深度学习模型?
- azure - o365 报告 API 无法获取报告