Error installing my new (& first) cli-generated plugin

Hello All,

I am using the new plugin support from the CLI for my 1st attempt to introduce plugin’s into my workflow

It started out great! Once I had the elements stabilized I just copied the files over from my project into the plugin skeleton and bang! they just worked.

I then published the plugin repo to our in-house gitLab (community edition) repo server

And now I’m back to the main project and trying to consume this plugin by installing it with npm and it’s complaining at me that there is no package.json file

I can’t even get to the point of calling it out in my code - I don’t know what I’ve done wrong.

(To get npm to stop complaining about certificate chains I had to turn off npm’s requirement for good certificates with this: npm set strict-ssl false)

I do not understand how it could complain that I do not have a package.json in my current directory – there is one here and also one in the plugin repo – in no way are they .gitignore’d

What am I doing wrong?

--- from the plugin project ---

$ ls -l
total 720
-rw-r--r--    1 ajoslin  staff    6835 Oct 26  1985 README.md
lrwxr-xr-x    1 ajoslin  admin      13 Jun  1 07:27 SAEImages -> ../SAEImages/
lrwxr-xr-x    1 ajoslin  admin      15 Jun  1 07:27 SAEShoppers -> ../SAEShoppers/
drwxr-xr-x    6 ajoslin  admin     192 May 31 20:04 aurelia_project
drwxr-xr-x    6 ajoslin  admin     192 May 31 21:00 dev-app
drwxr-xr-x    4 ajoslin  admin     128 Jun  1 08:23 dist
-rw-r--r--    1 ajoslin  staff   15086 Oct 26  1985 favicon.ico
-rw-r--r--    1 ajoslin  staff     302 Oct 26  1985 index.html
-rw-r--r--    1 ajoslin  staff     158 Oct 26  1985 jsconfig.json
drwxr-xr-x  658 ajoslin  admin   21056 May 31 20:13 node_modules
-rw-r--r--    1 ajoslin  admin  330539 May 31 20:13 package-lock.json
-rw-r--r--    1 ajoslin  staff    1509 May 31 23:23 package.json
drwxr-xr-x    6 ajoslin  admin     192 May 31 20:13 scripts
drwxr-xr-x    8 ajoslin  admin     256 May 31 21:07 src

$ cat .gitignore
.DS_STORE
Thumbs.db
.idea
.vscode/*
!.vscode/launch.json
node_modules
scripts
src/environment.js
gitVersion
test/coverage*
.chrome
*.zip
SAEImages
SAEShoppers

--- from the consuming project ---

$ ls -l
total 840
-rw-r--r--    1 ajoslin  admin     744 May 28 09:07 README.md
drwxr-xr-x    6 ajoslin  admin     192 May  2 11:26 aurelia_project
drwxr-xr-x   26 ajoslin  admin     832 Jun  1 07:29 dist
-rw-r--r--    1 ajoslin  admin   15086 Oct 26  1985 favicon.ico
-rw-r--r--@   1 ajoslin  admin     390 Oct 26  1985 index.ejs
-rw-r--r--    1 ajoslin  admin     188 Oct 26  1985 jsconfig.json
drwxr-xr-x  775 ajoslin  admin   24800 May 31 19:04 node_modules
-rw-r--r--    1 ajoslin  admin  382971 May 31 19:04 package-lock.json
-rw-r--r--    1 ajoslin  admin    1776 May 31 19:04 package.json
drwxr-xr-x   10 ajoslin  admin     320 May 24 13:47 src
drwxr-xr-x    4 ajoslin  admin     128 May 17 14:13 static
-rw-r--r--@   1 ajoslin  admin    8633 May 31 17:44 webpack.config.js

$ cat .gitignore
.DS_STORE
Thumbs.db
.idea
.vscode/*
!.vscode/launch.json
node_modules
dist
src/environment.js
gitVersion
test/coverage*
.chrome
*.zip

--- attempted consumption ---

$ npm i --save https://git.<ourdomain>.com/ajoslin/my-plugin.git
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: https://git.<ourdomain>.com/ajoslin/my-plugin.git.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ajoslin/.npm/_logs/2019-06-01T13_13_48_175Z-debug.log
$ caat /Users/ajoslin/.npm/_logs/2019-06-01T13_13_48_175Z-debug.log

$ cat /Users/ajoslin/.npm/_logs/2019-06-01T13_13_48_175Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/Users/ajoslin/.nvm/versions/node/v10.14.0/bin/node',
1 verbose cli   '/Users/ajoslin/.nvm/versions/node/v10.14.0/bin/npm',
1 verbose cli   'i',
1 verbose cli   '--save',
1 verbose cli   'https://git.<ourdomain>.com/ajoslin/my-plugin.git' ]
2 info using npm@6.7.0
3 info using node@v10.14.0
4 verbose npm-session f168af1f3cf770be
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://git.<ourdomain>.com/ajoslin/my-plugin 1205ms
8 silly fetchPackageMetaData error for https://git.<ourdomain>.com/ajoslin/my-plugin.git Non-registry package missing package.json: https://git.<ourdomain>.com/ajoslin/my-plugin.git.
9 timing stage:rollbackFailedOptional Completed in 0ms
10 timing stage:runTopLevelLifecycles Completed in 2481ms
11 verbose stack Error: Non-registry package missing package.json: https://git.<ourdomain>.com/ajoslin/my-plugin.git.
11 verbose stack     at BB.join (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/pacote/lib/finalize-manifest.js:163:23)
11 verbose stack     at tryCatcher (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
11 verbose stack     at Holder$5._callFunction (eval at generateHolderClass (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:14:44)
11 verbose stack     at Holder$5.checkFulfillment (eval at generateHolderClass (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:29:30)
11 verbose stack     at Promise.eval (eval at thenCallback (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:14:16), <anonymous>:6:20)
11 verbose stack     at Promise._settlePromise (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:566:21)
11 verbose stack     at Promise._settlePromise0 (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
11 verbose stack     at Promise._settlePromises (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:694:18)
11 verbose stack     at _drainQueueStep (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
11 verbose stack     at _drainQueue (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
11 verbose stack     at Async._drainQueues (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
11 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (/Users/ajoslin/.nvm/versions/node/v10.14.0/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
11 verbose stack     at runCallback (timers.js:705:18)
11 verbose stack     at tryOnImmediate (timers.js:676:5)
11 verbose stack     at processImmediate (timers.js:658:5)
12 verbose cwd /Users/ajoslin/Documents/Als/Development/EPC/Development/shop-and-earn/shop-and-earn-site
13 verbose Darwin 18.5.0
14 verbose argv "/Users/ajoslin/.nvm/versions/node/v10.14.0/bin/node" "/Users/ajoslin/.nvm/versions/node/v10.14.0/bin/npm" "i" "--save" "https://git.<ourdomain>.com/ajoslin/my-plugin.git"
15 verbose node v10.14.0
16 verbose npm  v6.7.0
17 error code ENOPACKAGEJSON
18 error package.json Non-registry package missing package.json: https://git.<ourdomain>.com/ajoslin/my-plugin.git.
19 error package.json npm can't find a package.json file in your current directory.
20 verbose exit [ 1, true ]
1 Like

Have you found anything about missing package.json when publishing to gitlab?

No, I went on to other things hoping that someone would know what I did wrong.

When you say, publishing – I just pushed the repo & then asked for it via npm

Is publishing different?

1 Like

The wording is based on what you said above. Is the package json file on the gitlab server?

Ha! And my wording is from the Aureliasite web page on the new cli plugin support :slight_smile:

https://aurelia.io/docs/plugins/write-new-plugin#structure-of-plugin

Absolutely it’s there - everything in the file listing that’s not in the .gitignore is there

I went back and re-read the Aureliasite web page on the new cli plugin and they do have a step I skipped ‘#4 npm publish’ but that’s because they show consuming the plugin before that.

When I try the npm publish it tries to push it to npm.org and I can’t have that happen.

1 Like

FYI: package.json has a safe guard "private": true to prevent accidental npm publish to publish your private package.

1 Like

yep, set to public early on…

Have you been able to publish & consume locally?

1 Like

You don’t need to publish locally. You can consume a npm package from a private github/bitbucket/gitlab repo.

"package-name": "gitlab:username/repo#tag"

The down side is you have to update tag (assume you have a tag for every version release) manually to latest version.

1 Like

But how is that different from what I did using npm ?

npm i --save https://git.<ourdomain>.com/ajoslin/my-plugin.git

you have me adding the line to package.json, and then I’d have to execute npm install to load it - which would then try to pull it

my use of the word: publish doesn’t indicate that I’ve used the ‘npm publish’ command – I was just [imperfectly] using the language of the guide

I’ll try it when I get a chance - but I don’t understand how it’s going to change anything

1 Like

You can ignore my suggestion. Your npm i --save <self-hosted-git-link> will work, and it will update package.json for you.

1 Like

but that is the essential problem – my command comes back saying that package.json cannot be found

and both my consuming and publishing repo’s certainly have their package.json files

it’s odd…

1 Like

Check your git server, is package.json file in your repo on server?

1 Like

Another easy test is to goto a clean folder, do a git clone ..., then check is there a package.json file inside.

1 Like