npm fails "Error: EACCES: permission denied, mkdir '/tmp/tryton/..."

0 views
Skip to first unread message

Dale Scott

unread,
Jun 6, 2024, 11:05:00 AMJun 6
to freebsd-...@freebsd.org
Hi all, I'm using npm to build an application (tryton-sao, the web
client for Tryton ERP) and it fails when run as a regular user because
of being unable to create a sub-directory in /tmp/, although the
permissions on /tmp look ok to me. Running npm as root using sudo
successfully completes, although npm issues warnings that using sudo is
not necessary, not recommended, and that I should fix my system.

From my notes, I was able to successfully run npm as a regular user in
May 2022 (FreeBSD-13.0), and I first found I needed to run npm using
sudo in Feb 2024 (FreeBSD-14.0)

Fwiw, I've also posted to the Forum presuming mailing lists users aren't
often forum users.
https://forums.freebsd.org/threads/npm-fails-error-eacces-permission-denied-mkdir-tmp-tryton.93702/

Can anyone point me towards the likely cause and solution? I'm sure it
will be obvious in hindsight. TIA!

## System

dale@whizzer:~ % uname -a
FreeBSD whizzer 14.0-RELEASE-p6 FreeBSD 14.0-RELEASE-p6 #0: Tue Mar 26
20:26:20 UTC 2024
ro...@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
amd64
dale@whizzer:~ % npm --version
10.5.1
dale@whizzer:~ %

## Permissions on /tmp

dale@whizzer:~ % ll -d /tmp
drwxrwxrwt 86 root wheel 1000 Jun 6 08:08 /tmp/

## Failure running npm as regular user

[tryton@whizzer ~/trytond/sao]$ npm install --production
--legacy-peer-deps
npm WARN config production Use `--omit=dev` instead.
npm WARN deprecated os...@0.1.5: This package is no longer supported.
npm WARN deprecated infl...@1.0.6: This module is not supported, and
leaks memory. Do not use it. Check out lru-cache if you want a good and
tested way to coalesce async requests by a key value, which is much more
comprehensive and powerful.
npm WARN deprecated gl...@7.1.7: Glob versions prior to v9 are no longer
supported

> tryto...@7.0.11 postinstall
> npx bower install

bower bootstrap#^3.3.7 cached
https://github.com/twbs/bootstrap.git#3.4.1
bower bootstrap#^3.3.7 validate 3.4.1 against
https://github.com/twbs/bootstrap.git#^3.3.7
bower qunit#^1.18 cached
https://github.com/jquery/qunit.git#1.23.1
..<snip>...
bower Sortable#^1.8.4 resolve
https://github.com/RubaXa/Sortable.git#^1.8.4
bower moment#^2.10 EACCES EACCES:
permission denied, mkdir
'/tmp/tryton/bower/673d4f049f0db3d188488f447477968a-75940-tGGj4Z'

Stack trace:
Error: EACCES: permission denied, mkdir
'/tmp/tryton/bower/673d4f049f0db3d188488f447477968a-75940-tGGj4Z'
..<snip>...
[tryton@whizzer ~/trytond/sao]$

## Success running npm using sudo

dale@whizzer:/home/tryton/trytond/sao % sudo npm install --production
--legacy-peer-deps

npm WARN config production Use `--omit=dev` instead.

> tryto...@7.0.11 postinstall
> npx bower install

bower ESUDO Please do not run with sudo

Additional error details:
Since bower is a user command, there is no need to execute it with
superuser permissions.
If you're having permission errors when using bower without sudo, please
spend a few minutes learning more about how your system should work and
make any necessary repairs.

http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814

You can however run a command with sudo using "--allow-root" option
bower jquery#^3 cached
https://github.com/jquery/jquery-dist.git#3.7.1
bower jquery#^3 validate 3.7.1 against
https://github.com/jquery/jquery-dist.git#^3
bower bootstrap#^3.3.7 cached
https://github.com/twbs/bootstrap.git#3.4.1
..<snip>...

bootstrap#3.4.1 bower_components/bootstrap
└── jquery#3.7.1

jquery#3.7.1 bower_components/jquery

papaparse#5.4.1 bower_components/papaparse

c3#0.7.20 bower_components/c3
└── d3#5.16.0

gettext.js#0.7.0 bower_components/gettext.js

mousetrap#1.6.5 bower_components/mousetrap

moment#2.30.1 bower_components/moment

qunit#1.23.1 bower_components/qunit

Sortable#1.15.2 bower_components/Sortable

fullcalendar#3.10.5 bower_components/fullcalendar
├── jquery#3.7.1
└── moment#2.30.1

bootstrap-rtl-ondemand#3.3.4-ondemand
bower_components/bootstrap-rtl-ondemand
└── bootstrap#3.4.1

d3#5.16.0 bower_components/d3

up to date, audited 137 packages in 5s

12 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 10.5.1 -> 10.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.1
npm notice Run npm install -g n...@10.8.1 to update!
npm notice
dale@whizzer:/home/tryton/trytond/sao %


--
Dale Scott
www.dalescott.net

Dale Scott

unread,
Jun 6, 2024, 2:37:11 PMJun 6
to freebsd-...@freebsd.org
On 2024-06-06 09:04, Dale Scott wrote:

> Stack trace:
> Error: EACCES: permission denied, mkdir
> '/tmp/tryton/bower/673d4f049f0db3d188488f447477968a-75940-tGGj4Z'

Thanks to @SirDice in the forum!

Cause was /tmp/tryton/ already existed not owned by the user executing
npm. Solution was simply to delete /tmp/tryton. Hurrah!.


Reply all
Reply to author
Forward
0 new messages