Package.json file missing [error: ENOLOCAL]

Package.json file missing [error: ENOLOCAL]

前言

git 服务器上有一个 自用的 npm 包,现在该 npm 包需要在微信小程序中使用,如何安装并使用呢?
注意:本文中 git 地址纯属虚构

环境

  • 微信小程序

安装

npm i git@66.66.666:/data/source/xxx.git

报错如下
在这里插入图片描述

  • 2021-06-02T09_16_37_191Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/wujiang/.nvs/node/14.15.0/x64/bin/node',
1 verbose cli   '/Users/wujiang/.nvs/default/bin/npm',
1 verbose cli   'i',
1 verbose cli   'git@66.66.666:/data/source/xxx.git'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.0
4 verbose npm-session d45347e2283df446
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for git@file:66.66.666:/data/source/xxx.git Could not install from "66.66.666:/data/source/xxx.git" as it does not contain a package.json file.
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 48ms
10 verbose stack Error: ENOENT: no such file or directory, open '/workSpace/git/home/school-wx/66.66.666:/data/source/xxx.git/package.json'
11 verbose cwd /workSpace/git/home/school-wx
12 verbose Darwin 18.7.0
13 verbose argv "/Users/wujiang/.nvs/node/14.15.0/x64/bin/node" "/Users/wujiang/.nvs/default/bin/npm" "i" "git@66.66.666:/data/source/xxx.git"
14 verbose node v14.15.0
15 verbose npm  v6.14.8
16 error code ENOLOCAL
17 error Could not install from "66.66.666:/data/source/xxx.git" as it does not contain a package.json file.
18 verbose exit [ 1, true ]

寻求stackoverflow帮助

How to install an npm package from GitHub directly?
在这里插入图片描述

寻求GitHub帮助

Package.json file missing [error: ENOLOCAL] #640
在这里插入图片描述
操作如下

npm i git+ssh://git@66.66.666:/data/source/xxx.git

在这里插入图片描述
安装成功

总结

  • 我们遇到的问题多半在网上有现成的解决方法
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值