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
安装成功
总结
- 我们遇到的问题多半在网上有现成的解决方法