I have a snapcraft.yaml
that contains a section like this:
ui:
plugin: npm
source: https://github.com/lemmynet/lemmy-ui.git
npm-node-version: 14.13.0
Which results in this error:
Building ui
+ [ ! -f /root/parts/ui/install/bin/node ]
+ curl -s https://nodejs.org/dist/v14.13.0/node-v14.13.0-linux-x64.tar.gz
+ tar xzf - -C /root/parts/ui/install/ --strip-components=1
+ npm pack .
+ tail -1
npm ERR! package.json requires a valid "version" field
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-06T18_18_38_075Z-debug.log
+ npm install -g --prefix /root/parts/ui/install
npm ERR! Can't install /root/parts/ui/build: Missing package version
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-06T18_18_38_555Z-debug.log
Failed to build 'ui'.
Recommended resolution:
Check the build logs and ensure the part's configuration and sources are correct.
I also tried building the step manually:
ui:
plugin: dump
source: https://github.com/lemmynet/lemmy-ui.git
build-snaps:
- node/14/stable
stage-snaps:
- node/14/stable
override-build: |
set -eux
snapcraftctl build
node.yarn install --pure-lockfile
node.yarn
node.yarn build:prod
This resulted in the following error:
Building ui
+ snapcraftctl build
+ cp --archive --link --no-dereference . /root/parts/ui/install
cp: cannot create hard link '/root/parts/ui/install/./LICENSE' to './LICENSE': File exists
cp: cannot create hard link '/root/parts/ui/install/./package.json' to './package.json': File exists
cp: cannot create hard link '/root/parts/ui/install/./README.md' to './README.md': File exists
Failed to build 'ui'.
Recommended resolution:
Check the build logs and ensure the part's configuration and sources are correct.
+ node.yarn install --pure-lockfile
For reference, I’m trying to do the equivalent of what’s in this Dockerfile:
What is the recommended way of handling yarn installs like this with core20
?