Opened 9 years ago

Closed 3 years ago

#48127 closed defect (wontfix)

npm 2.11.2 fails user prefix build

Reported by: posita (Matt Bogosian) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: ci42, su-v, dgsb (David Bariod)
Port: npm

Description

From main.log (complete file attached):

...
:info:destroot > node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc
:info:destroot
:info:destroot sh: rimraf: command not found
:info:destroot
:info:destroot npm ERR! addLocalDirectory Could not pack [[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports
_devel_npm/npm/work/package to [[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_npm/npm/work/.home/
.npm/npm/2.11.2/package.tgz
:info:destroot npm ERR! addLocal Could not install [[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel
_npm/npm/work/package
:info:destroot npm ERR! Darwin 13.4.0
:info:destroot npm ERR! argv "[[PREFIX]]/bin/node" "[[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_deve
l_npm/npm/work/package/cli.js" "install" "--global" "." "--prefix=[[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarba
lls_ports_devel_npm/npm/work/destroot[[PREFIX]]"
:info:destroot npm ERR! node v0.12.4
:info:destroot npm ERR! npm  v2.11.2
:info:destroot npm ERR! file sh
:info:destroot npm ERR! code ELIFECYCLE
:info:destroot npm ERR! errno ENOENT
:info:destroot npm ERR! syscall spawn
:info:destroot npm ERR! npm@2.11.2 prepublish: `node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc`
:info:destroot npm ERR! spawn ENOENT
:info:destroot npm ERR!
:info:destroot npm ERR! Failed at the npm@2.11.2 prepublish script 'node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc'.
:info:destroot npm ERR! This is most likely a problem with the npm package,
:info:destroot npm ERR! not with npm itself.
:info:destroot npm ERR! Tell the author that this fails on your system:
:info:destroot npm ERR!     node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc
:info:destroot npm ERR! You can get their info via:
:info:destroot npm ERR!     npm owner ls npm
:info:destroot npm ERR! There is likely additional logging output above.
:info:destroot
:info:destroot npm ERR! Please include the following file with any support request:
:info:destroot npm ERR!     [[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_npm/npm/work/package/npm-debug.log
:info:destroot Command failed:  cd "[[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_npm/npm/work/package" && [[PREFIX]]/bin/node ./cli.js install --global . --prefix=[[PREFIX]]/var/macports/build/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_npm/npm/work/destroot[[PREFIX]]
:info:destroot Exit code: 1
:error:destroot org.macports.destroot for port npm returned: command execution failed
:debug:destroot Error code: CHILDSTATUS 28393 1
:debug:destroot Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec destroot"
    (procedure "portdestroot::destroot_main" line 2)
    invoked from within
"portdestroot::destroot_main org.macports.destroot"
    ("eval" body line 1)
    invoked from within
"eval $procedure $targetname"
:info:destroot Warning: targets not executed for npm: org.macports.activate org.macports.destroot org.macports.install
:notice:destroot Please see the log file for port npm for details:
    [[PREFIX]]/var/macports/logs/[[PREFIX]]_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_npm/npm/main.log

Attachments (2)

main.log (43.7 KB) - added by posita (Matt Bogosian) 9 years ago.
main.log-rimraf-hack (1.6 MB) - added by posita (Matt Bogosian) 9 years ago.
main.log with PREFIX?/bin/rimraf hack script

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by posita (Matt Bogosian)

Attachment: main.log added

comment:1 Changed 9 years ago by su-v

Cc: suv-sf@… added

Cc Me!

comment:2 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

On my normal root MacPorts installation, I get:

npm WARN cannot run in wd npm@2.11.3 node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc (wd=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_devel_npm/npm/work/package)

I don't know why it cannot run the command on my system but does attempt to do so on your system, but I also don't know why the npm build wants to run the command at all. Certainly, it would not be right to try to run the rimraf command when that command does not exist. (rimraf is a cross-platform implementation of rm -rf.) This command line appears in npm's package.json in the prepublish key. We're just asking to install npm, not publish anything, so I don't understand why a prepublish step is being run, but maybe I don't know what npm means by "publish". In any case, it sounds like a mistake in the npm build system, which you should report to the developers of npm.

Changed 9 years ago by posita (Matt Bogosian)

Attachment: main.log-rimraf-hack added

main.log with PREFIX?/bin/rimraf hack script

comment:3 Changed 9 years ago by posita (Matt Bogosian)

For kicks, I created [[PREFIX]]/bin/rimraf as follows:

#!/usr/bin/env sh
set -ex
echo "${0}"
exec rm -fr ${1+"${@}"}

Then I ran port clean --all npm && port install npm. It "worked" (new main.log attached).

I'm curious why @ryandesign's build would find rimraf (and where), but mine wouldn't.

Could this be solved by temporarily augmenting PATH during the build process?

For what it's worth, I can install a localized npm into ${HOME}/.npm (per these instructions) without issue, so I'm not sure it's an upstream packaging issue? It might be, but I doubt I'll get much traction there.

comment:4 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

rimraf doesn't exist; npm should not be attempting to run it. The root build doesn't attempt to run the command, while your non-root build does; I don't know why.

comment:5 Changed 9 years ago by posita (Matt Bogosian)

Ah, okay. Sorry for misunderstanding. I now understand what you're referring to with the prepublish phase (from package.json). After some investigation, I'm pretty sure @ryandesign is right that this is an npm issue:

npm/npm#7040

Please feel free to close. I will continue to investigate and possibly reopen if a fix for that issue does not resolve the problem described in the OP.

comment:6 Changed 9 years ago by apowers313@…

Having the same problem with rimraf not existing when installing as a non-root user into an alternate MacPorts directory. Was a solution ever found?

comment:7 Changed 8 years ago by dgsb (David Bariod)

Cc: davidriod@… added

Cc Me!

comment:8 Changed 3 years ago by mf2k (Frank Schima)

Resolution: wontfix
Status: newclosed

This port no longer exists.

Note: See TracTickets for help on using tickets.