Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create command fails with npm not relative to node #1353

Closed
Alxandr opened this issue Mar 29, 2018 · 8 comments
Closed

Create command fails with npm not relative to node #1353

Alxandr opened this issue Mar 29, 2018 · 8 comments
Assignees
Milestone

Comments

@Alxandr
Copy link

Alxandr commented Mar 29, 2018

The create command fails, because it's trying to stat a file that doesn't exist:

image

It should not assume npm to be relative to node.

Expected Behavior

It should not crash.

Current Behavior

It's crashing.

Workaround

In my case, creating a symlink to npm next to the node executable solved the problem.

Steps to Reproduce (for bugs)

  1. Have node and npm not installed next to eachother. I have that via homebrew. My path to node is /usr/local/Cellar/node/9.9.0/bin/node, whereas npm is installed at /usr/local/lib/node_modules/npm/bin/npm-cli.js.
  2. Run lerna create <name>.
lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "0.0.0"
}

lerna-debug.log

0 silly argv { _: [ 'create' ],
0 silly argv   help: false,
0 silly argv   h: false,
0 silly argv   version: false,
0 silly argv   v: false,
0 silly argv   'reject-cycles': undefined,
0 silly argv   rejectCycles: undefined,
0 silly argv   sort: undefined,
0 silly argv   ci: false,
0 silly argv   lernaVersion: '3.0.0-beta.11',
0 silly argv   '$0': '/usr/local/bin/lerna',
0 silly argv   loglevel: undefined,
0 silly argv   concurrency: undefined,
0 silly argv   'max-buffer': undefined,
0 silly argv   name: '@yolodev/workdir-pid',
0 silly argv   loc: undefined,
0 silly argv   access: undefined,
0 silly argv   bin: undefined,
0 silly argv   description: undefined,
0 silly argv   dependencies: undefined,
0 silly argv   'es-module': undefined,
0 silly argv   homepage: undefined,
0 silly argv   keywords: undefined,
0 silly argv   license: undefined,
0 silly argv   private: undefined,
0 silly argv   registry: undefined,
0 silly argv   tag: undefined,
0 silly argv   yes: undefined }
1 info version 3.0.0-beta.11
2 verbose rootPath /Users/alxandr/hub/yolodev-aspnet-utils
3 silly isInitialized
4 silly isInitialized true
5 error Error: ENOENT: no such file or directory, lstat '/usr/local/Cellar/node/9.9.0/bin/npm'
5 error     at Object.realpathSync (fs.js:1690:15)
5 error     at builtinNpmrc (/usr/local/lib/node_modules/lerna/node_modules/@lerna/create/lib/builtin-npmrc.js:12:26)
5 error     at CreateCommand.initialize (/usr/local/lib/node_modules/lerna/node_modules/@lerna/create/index.js:89:23)
5 error     at Promise.resolve.then (/usr/local/lib/node_modules/lerna/node_modules/@lerna/command/index.js:220:24)
5 error     at <anonymous>

Context

Your Environment

OSX, node installed from homebrew. Don't remember where npm is installed from, but considering it's path I'd say it's likely installed using npm itself.

Executable Version
lerna --version 3.0.0-beta.11
npm --version 5.6.0
yarn --version 1.5.1
node --version v9.9.0
OS Version
macOS High Sierra 10.13.3
@evocateur
Copy link
Member

Oh dang, I forgot that could be a thing. Thanks for the bug report!

(Homebrew's node has been a pain-in-the-arse from day one, in my experience, far preferable to use nvm).

@evocateur evocateur added the bug label Mar 29, 2018
@evocateur evocateur added this to the v3.0.0 milestone Mar 29, 2018
@Alxandr
Copy link
Author

Alxandr commented Mar 29, 2018

That may very well be so, but I think the community you'd have to convince is rather huge ^^

@evocateur
Copy link
Member

Oh, sure, I didn't mean to imply I'm not going to fix this, I just completely forgot about this case.

@Alxandr
Copy link
Author

Alxandr commented Mar 29, 2018

Yeah, I got that. I was just joking :)

@evocateur evocateur self-assigned this Mar 29, 2018
@evocateur
Copy link
Member

Published in v3.0.0-beta.12

@Alxandr
Copy link
Author

Alxandr commented Mar 30, 2018

Wouldn't it be better to try to locate npm by way of where npm (ie. scan $PATH). That way you would get the noe the user is using (unless they specifically ran another one).

@evocateur
Copy link
Member

evocateur commented Mar 30, 2018 via email

@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants