npm ERR! `unsafe-perm` is not a valid npm option

Bug #2015640 reported by Loïc Minier
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Snapcraft
Confirmed
Undecided
Unassigned

Bug Description

Hi,

The npm plugin runs:
  npm config set unsafe-perm true
during builds; this is not supported in recent npms and causes an error:
2023-04-08 16:55:43.386 :: 2023-04-08 16:55:41.117 :: + tar xzf - -C /root/parts/hello-node/install/ --no-same-owner --strip-components=1
2023-04-08 16:55:43.386 :: 2023-04-08 16:55:42.622 :: + npm config set unsafe-perm true
2023-04-08 16:55:43.386 :: 2023-04-08 16:55:42.882 :: npm ERR! `unsafe-perm` is not a valid npm option
2023-04-08 16:55:43.386 :: 2023-04-08 16:55:42.883 ::
2023-04-08 16:55:43.386 :: 2023-04-08 16:55:42.883 :: npm ERR! A complete log of this run can be found in:
2023-04-08 16:55:43.386 :: 2023-04-08 16:55:42.883 :: npm ERR! /root/.npm/_logs/2023-04-08T16_55_42_865Z-debug-0.log

This can be reproduced with a snapcraft.yaml such as:
=====
name: hello-node
base: core22
version: '1.0'
summary: Whatever
description: Whatever
grade: devel
confinement: devmode

parts:
  hello-node:
    plugin: npm
    source: src
    npm-include-node: true
    npm-node-version: 18.15.0
=====

With node-version 16.15.0, the build works; with node-version 18.15.0 it fails. 18.15.0 is the current upstream LTS node version, while the latest release is 19.8.1.

Here's a git repo with a sample hello world nodejs/npm snap:
https://github.com/lool/hello-node-snap

Best,

Changed in snapcraft:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.