This repository has been archived by the owner. It is now read-only.

npm3 confused about misplaced node_modules/package.json #9285

Open
timoxley opened this Issue Aug 15, 2015 · 11 comments

Comments

Projects
None yet
5 participants
@timoxley
Member

timoxley commented Aug 15, 2015

Accidentally ended up with a package.json in node_modules.

npm v3.3.0 doesn't take it well:

npm-packagejson-node_modules@1.0.0 /Users/timoxley/Projects/tests/npm-packagejson-node_modules
├── UNMET DEPENDENCY inherits@^2.0.1
└──  extraneous error: ENOTDIR: not a directory, open '/Users/timoxley/Projects/tests/npm-packagejson-node_modules/node_modules/package.json/package.json

Problem is the ENOTDIR: not a directory, open.

Works fine in npm v2.

To reproduce, use npm v3 to npm ls in https://github.com/timoxley/npm-packagejson-node_modules

git clone https://github.com/timoxley/npm-packagejson-node_modules
cd npm-packagejson-node_modules
npm test

@othiym23 othiym23 added the bug label Aug 17, 2015

@othiym23 othiym23 added this to the 3.x milestone Aug 17, 2015

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Aug 17, 2015

Member

Ok, so what you're reporting is that:

If a non-directory is placed in the node_modules folder then npm ls will report that this is the case in npm@3 where it didn't in npm@2.

Additionally, it does this in rather fraught terms "omg extraneous, augh error!!".

I would propose that we should be reporting this. Eg, if I run npm ls I want to know what's in my node_modules folder... But maybe at a warning level (or just a note) and with a more useful message like "plain file found in node_modules folder".

Member

iarna commented Aug 17, 2015

Ok, so what you're reporting is that:

If a non-directory is placed in the node_modules folder then npm ls will report that this is the case in npm@3 where it didn't in npm@2.

Additionally, it does this in rather fraught terms "omg extraneous, augh error!!".

I would propose that we should be reporting this. Eg, if I run npm ls I want to know what's in my node_modules folder... But maybe at a warning level (or just a note) and with a more useful message like "plain file found in node_modules folder".

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Aug 18, 2015

Member

Backchannel talk w/ @othiym23: He'd like the message suppressed entirely unless the user explicitly asks for it.

Member

iarna commented Aug 18, 2015

Backchannel talk w/ @othiym23: He'd like the message suppressed entirely unless the user explicitly asks for it.

@iarna iarna modified the milestones: 3.x-next-next, 3.x Aug 18, 2015

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Aug 18, 2015

Member

Ok, so what we're gonna do is suppress error entries that have ENOTDIR registered as their only error. This will allow random file cruft in your node_modules while still reporting, say, parse errors in your linked deps package.json files.

Member

iarna commented Aug 18, 2015

Ok, so what we're gonna do is suppress error entries that have ENOTDIR registered as their only error. This will allow random file cruft in your node_modules while still reporting, say, parse errors in your linked deps package.json files.

@timoxley

This comment has been minimized.

Show comment
Hide comment
@timoxley

timoxley Aug 20, 2015

Member

@iarna sounds good to me 👍

Member

timoxley commented Aug 20, 2015

@iarna sounds good to me 👍

@iarna iarna modified the milestones: 3.x-next, 3.x-next-next Aug 21, 2015

@iarna iarna modified the milestones: 3.x-next-next, 3.x-next Sep 11, 2015

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Sep 11, 2015

Member

I underestimated how painful writing the tests tests for #9537 would be, combined with the short week, so this has to be pushed out.

Member

iarna commented Sep 11, 2015

I underestimated how painful writing the tests tests for #9537 would be, combined with the short week, so this has to be pushed out.

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Sep 17, 2015

Member

Thank you for this, we shipped the fix for this in npm@3.3.4

Member

iarna commented Sep 17, 2015

Thank you for this, we shipped the fix for this in npm@3.3.4

@iarna iarna closed this Sep 17, 2015

@iarna iarna removed the in-progress label Sep 17, 2015

@calshankar

This comment has been minimized.

Show comment
Hide comment
@calshankar

calshankar Oct 18, 2015

Hi @iarna

This issue seems to persist on V 3.3.8 even after re-installing the node version afresh after purging


npm ERR! error in /usr/local/lib/node_modules/npm-debug.log: ENOTDIR, open '/usr/local/lib/node_modules/npm-debug.log/package.json'
npm ERR! invalid: bplist-parser@0.1.0 /usr/local/lib/node_modules/appium/node_modules/bplist-parser```

calshankar commented Oct 18, 2015

Hi @iarna

This issue seems to persist on V 3.3.8 even after re-installing the node version afresh after purging


npm ERR! error in /usr/local/lib/node_modules/npm-debug.log: ENOTDIR, open '/usr/local/lib/node_modules/npm-debug.log/package.json'
npm ERR! invalid: bplist-parser@0.1.0 /usr/local/lib/node_modules/appium/node_modules/bplist-parser```
@othiym23

This comment has been minimized.

Show comment
Hide comment
@othiym23

othiym23 Oct 21, 2015

Contributor

@calshankar I've seen this too, so I'm going to reopen this until we figure out whether this is the same issue, or an instance of a new issue.

Contributor

othiym23 commented Oct 21, 2015

@calshankar I've seen this too, so I'm going to reopen this until we figure out whether this is the same issue, or an instance of a new issue.

@othiym23 othiym23 reopened this Oct 21, 2015

@othiym23 othiym23 modified the milestones: 3.x, 3.3.4, next-next-3 Oct 21, 2015

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Oct 26, 2015

Member

ok, this only happens with globals, which is why existing tests didn't find it

Member

iarna commented Oct 26, 2015

ok, this only happens with globals, which is why existing tests didn't find it

@iarna iarna added this to the next-next-3 milestone Oct 27, 2015

@iarna iarna modified the milestones: next-3, next-next-3 Oct 27, 2015

@iarna iarna modified the milestones: next-next-3, next-3 Nov 10, 2015

@iarna iarna removed their assignment Apr 25, 2016

@nakedcity

This comment has been minimized.

Show comment
Hide comment
@nakedcity

nakedcity Nov 22, 2016

Any update on this one? I see this also happening e.g entry.node.spec.ts/package.json I'm using 3.10.9

nakedcity commented Nov 22, 2016

Any update on this one? I see this also happening e.g entry.node.spec.ts/package.json I'm using 3.10.9

@timoxley

This comment has been minimized.

Show comment
Hide comment
@timoxley

timoxley Aug 3, 2017

Member

@iarna I believe this may be fixed in latest.

Member

timoxley commented Aug 3, 2017

@iarna I believe this may be fixed in latest.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.