I am trying to create a snap package from a nodejs project, but it fails with the following error:
/root/parts/pkg-name/npm/bin/npm install --unsafe-perm --offline --prod
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/body-parser failed: cache mode is 'only-if-cached' but no cached response available.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-15T11_01_23_941Z-debug.log
Failed to run '/root/parts/pkg-name/npm/bin/npm install --unsafe-perm --offline --prod' for 'pkg-name: Exited with code 1.
Verify that the part is using the correct parameters and try again.
snapcraft version:
snapcraft --version
snapcraft, version 4.0.4
Here is my snapcraft.yaml file
name: pkg-name
base: core18
version: git
summary: pkg-name# 79 char long summary
description: |
pkg-name
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
parts:
pkg-name:
plugin: nodejs
nodejs-version: '10.21.0'
nodejs-package-manager: 'npm'
source: .
stage-packages:
- libfprint-dev
build-packages:
- pkg-config
- zlib1g-dev
- g++
apps:
pkg-name:
command: pkg-name-snap
daemon: simple
restart-condition: always
plugs:
- network
- network-bind
- raw-usb
body-parser is a dependency in my package.json
{
"name": "pkg-name-server",
"version": "0.2.0",
"description": "HTTP server for libfprint to enroll & identify remotely",
"main": "server.js",
"bin": {
"pkg-name": "bin/run.js",
"pkg-name-snap": "bin/run-snap.js"
},
"license": "MIT",
"dependencies": {
"pkg-name-frontend": "^0.2.0",
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"loglevel": "^1.6.8",
"loglevel-plugin-prefix": "^0.8.4",
"luxon": "^1.24.1",
"node-fprint": "0.0.9"
},
"bundledDependencies": [
"pkg-name-frontend"
],
"devDependencies": {}
}
To me it seems like snapcraft tries to install body-parser from cache, but there is none ?