Pipeline error when installing as devDependency
gr2m opened this issue · 8 comments
I want to automatically build my packages on CI before publishing them with semantic-release. It would be helpful to add @pika/pack
to devDependencies
because I could add a build step to my CI making sure that it still works and Greenkeeper would run the CI for each new release of @pika/pack
and would create an issue if something breaks.
If I would run npm i -g @pika/pack
in CI it would always install the latest version and things would break with a new breaking version. If I would fix the version with npm i -g @pika/pack@0.3.7
I wouldn’t get the goodies from new versions :)
Reproduce
$ node -v
v10.15.3
$ npm -v
6.9.0
$ git clone git@github.com:pikapkg/examples.git
Cloning into 'examples'...
remote: Enumerating objects: 288, done.
remote: Counting objects: 100% (288/288), done.
remote: Compressing objects: 100% (131/131), done.
remote: Total 288 (delta 127), reused 288 (delta 127), pack-reused 0
Receiving objects: 100% (288/288), 87.23 KiB | 656.00 KiB/s, done.
Resolving deltas: 100% (127/127), done.
$ cd examples/typescript-package/
$ npm install
added 234 packages from 162 contributors and audited 4834 packages in 15.192s
found 0 vulnerabilities
$ npm install -D @pika/pack
npm notice created a lockfile as package-lock.json. You should commit this file.
+ @pika/pack@0.3.7
added 97 packages from 42 contributors and audited 141 packages in 5.777s
found 0 vulnerabilities
$ npx pack build
@pika/pack build v0.3.7
Error: Cannot find module '@pika/plugin-ts-standard-pkg'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at resolveFileName (/private/tmp/examples/typescript-package/node_modules/resolve-from/index.js:17:39)
at resolveFrom (/private/tmp/examples/typescript-package/node_modules/resolve-from/index.js:31:9)
at module.exports (/private/tmp/examples/typescript-package/node_modules/resolve-from/index.js:34:41)
at module.exports (/private/tmp/examples/typescript-package/node_modules/import-from/index.js:4:49)
at /private/tmp/examples/typescript-package/node_modules/@pika/pack/dist-node/index.js:5144:39
at Generator.next (<anonymous>)
at asyncGeneratorStep (/private/tmp/examples/typescript-package/node_modules/@pika/pack/dist-node/index.js:47:24)
at _next (/private/tmp/examples/typescript-package/node_modules/@pika/pack/dist-node/index.js:69:9)
at /private/tmp/examples/typescript-package/node_modules/@pika/pack/dist-node/index.js:76:7
The error is the same when running ./node_modules/.bin/pack build
or when adding "build": "pack build"
to scripts and running npm run build
hmm sorry now the global install does not work either, it’s odd.
Maybe the reason might be that the version in package.json is not the same version as gets installed from npm? How is this even possible?!
$ npm init -y
Wrote to /private/tmp/pika-test/package.json:
{
"name": "pika-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
$ npm i @pika/plugin-ts-standard-pkg
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @pika/plugin-ts-standard-pkg@0.3.15 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN pika-test@1.0.0 No description
npm WARN pika-test@1.0.0 No repository field.
+ @pika/plugin-ts-standard-pkg@0.3.15
added 58 packages from 55 contributors and audited 109 packages in 3.312s
found 0 vulnerabilities
$ cat node_modules/\@pika/plugin-ts-standard-pkg/package.json | grep version
"version": "0.3.14"
See
+ @pika/plugin-ts-standard-pkg@0.3.15
And then
"version": "0.3.14"
in node_modules/@pika/plugin-ts-standard-pkg/package.json
¯\_(ツ)_/¯
Probably same issue? I have tried with Travis CI to run the tests, but:
$ npm ci
npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR!
npm ERR!
npm ERR! Missing: @pika/plugin-build-node@^0.3.15
npm ERR! Missing: @pika/plugin-build-web@^0.3.15
npm ERR! Missing: @pika/plugin-ts-standard-pkg@^0.3.15
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/travis/.npm/_logs/2019-04-23T20_10_22_901Z-debug.log
And I already re-generated the package-lock.json
with:
rm -rf node_modules package-lock.json; npm install
You can see it here: https://travis-ci.com/abdonrd/slugify/builds/109342083
I have no idea how this happened, but I may have done a bad publish a few days back. I just re-published everything under v0.3.16
, mind bumping and trying install again?
Thank you @FredKSchott, the original problem does no longer occur, but there is a new error I get from the deno build plugin
$ npx pack build
@pika/pack build v0.3.7
[1/7] Validating source...
[2/7] Preparing pipeline...
❇️ pkg/
Error: @pika/plugin-build-deno can only handle packages already written for Deno. Exiting because we could not find deno on your machine.
at execa.catch.err (/private/tmp/examples/typescript-package/node_modules/@pika/plugin-build-deno/dist-node/index.js:62:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
I wonder, maybe remove the deno plugin? I’m not sure if it’s needed for a simple typescript example?
That's a really good point, separate "typescript" & "deno" examples would make a lot more sense. If you have any interest in contributing back, I'd be happy to review & merge!
It works now, thanks @FredKSchott!
I’m afraid I cannot help right now, but it would make a nice first-time contributor issue :)
Closing since it looks like this was resolved