Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Unexpected "not a child of" error #18233

Open
2 of 4 tasks
ashubham opened this issue Aug 19, 2017 · 7 comments
Open
2 of 4 tasks

Unexpected "not a child of" error #18233

ashubham opened this issue Aug 19, 2017 · 7 comments
Labels

Comments

@ashubham
Copy link

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

Basically I would want to reopen #17637. Because I still see this with npm 5.3.0 and node 8.4

How can the CLI team reproduce the problem?

package.json should contain a relative path to a dependency, which in turn contains some
optional dependencies. (fsevents) in my case.

gist: https://gist.github.com/ashubham/da37468a1033af23113938036522a036

supporting information:

OS: Linux

@jeffhallrsn
Copy link

I'm also seeing this issue with npm 5.3.0 and node 8.4 and fsevents in a monorepo style repo.

npm ERR! /blabla/node_modules/fsevents/node_modules/abbrev is not a child of /blabla2

@sulliwane
Copy link

sulliwane commented Sep 5, 2017

Same issue here with current docker node:8.4.0-alpine node v8.4.0 and npm 5.3.0

npm ERR! /home/node/app/node_modules/fsevents/node_modules/abbrev is not a child of /home/node/.npm-global/lib

Edit 1: here is my Dockerfile (my node app is a cli I need to install in global PATH)

FROM node:8.4.0-alpine

ENV user node
ENV PATH=/home/node/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global


RUN mkdir /home/$user/app
COPY . /home/$user/app/
RUN chown -R $user: /home/$user/app

USER $user

RUN mkdir /home/$user/.npm-global

WORKDIR /home/$user/app
RUN npm -g i

ENTRYPOINT ["myapp"]

Edit 2: Tried with node:8.1.0-alpine and it's working (node 8.1.0 and npm 5.0.3).

CONCLUSION : Problem is probably related to NPM 5.3.0 !

@cepiloyo
Copy link

Same issue, also with fsevents/node_modules/abbrev:
/var/lib/jenkins/workspace/lib1/node_modules/fsevents/node_modules/abbrev is not a child of /var/lib/jenkins/workspace/lib2

lib1 is sym-linked (npm link) in lib2. When the projects are not sim-linked (published internally) it works just fine.

NPM version: 5.3.0

@salim7
Copy link

salim7 commented Sep 25, 2017

Does anyone know a workaround on this?
Problem still exists with NPM version 5.4.2
Workaround: npm install --no-optional helped for now.

@eamondawes
Copy link

Thanks for the workaround @asado7, I'm also running into this issue in npm 5,4,2 with node 6.11.3

@kenany kenany added the npm5 label Oct 5, 2017
stuhood pushed a commit to pantsbuild/pants that referenced this issue Oct 16, 2017
)

### Problem
Due to change introduced in [npm/npm-15900](npm/npm#15900), source level dependencies are no longer installed, but symlinked directly.  This means we can no longer reference dependencies of dependencies directly any more since they will no longer be on execution path.
Additionally, due to an open npm issue npm/npm#18233, we need to add '--no-optional' in npm install command to workaround temporarily. 

### Solution
The fix is to supply all resolved node modules as a part of execution path. This can potentially have another side effect that is we might end up with two versions of same binaries on the execution path.  I am not sure if there is a good way to resolve this issue at current time, but we should keep an eye on the possibility.

### Result
Travis tests running with node 8.6.0 (npm 5.3.0) passes. 
https://travis-ci.org/pantsbuild/pants/builds/286743908 => Failed on shard 1 with unrelated issues.
@mtomov
Copy link

mtomov commented Oct 28, 2017

Same here on linux

➜  npm --version
5.5.1
➜  nodejs --version
v6.11.4

@SanketDG
Copy link

Does anyone have a solution to this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants