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

not able to create a project if npm is not installed #3393

Closed
urkle opened this issue Jan 30, 2019 · 6 comments
Closed

not able to create a project if npm is not installed #3393

urkle opened this issue Jan 30, 2019 · 6 comments

Comments

@urkle
Copy link

urkle commented Jan 30, 2019

Version

3.3.0

Environment info

Environment Info:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz
  Binaries:
    Node: 8.15.0 - /opt/local/bin/node
    Yarn: 1.12.3 - /opt/local/bin/yarn
    npm: Not Found
  Browsers:
    Chrome: 72.0.3626.81
    Firefox: 64.0.2
    Safari: 12.0.3
  npmGlobalPackages:
    @vue/cli: Not Found

(@vue/cli is installed globally via yarn.

Steps to reproduce

vue create myproject

What is expected?

it to work toward creating the project

What is actually happening?

 ERROR  Error: spawn npm ENOENT
Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:362:16)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
    at Function.Module.runMain (module.js:696:11)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
@urkle
Copy link
Author

urkle commented Jan 30, 2019

Workaround

I created a dummy "npm" binary that simply ran yarn w/ the args. (I should not have to do this)

@yooouuri
Copy link

yooouuri commented Feb 5, 2020

@urkle do you have the code for me? Im having the same issue here

@urkle
Copy link
Author

urkle commented Feb 5, 2020

@yooouuri this is fixed in recent versions of Vue cli (at least for create)

@yooouuri
Copy link

yooouuri commented Feb 5, 2020

@urkle

Sadly it is not for vue add ... and vue upgrade ....

I am using a monorepo with (for now) one Vue project.

When I run for example vue add vuex in the root of my monorepo, it tries to add it to the root (with yarn). Ofc I don't want that. When I run vue add vuex inside the Vue project package (packages/vue-project), it forces me to use npm...

@sodatea
Copy link
Member

sodatea commented Feb 6, 2020

I've opened #5150 to fix this issue.

@yooouuri
Copy link

yooouuri commented Feb 6, 2020

@sodatea

Thanks, would be nice to see this issue to be fixed. Had to write an ugly fix...

Removed npm, added the following script (as npm) to my path.

#/bin/sh

args=("$@")

echo $args

if [ "${args[0]}" == "install" ]; then
    echo "lets fake the npm install"

    # where args[3] is for example @vue/cli-plugin-eslint and args4 is -D
    if [ "${args[3]:0:4}" == "@vue" ]; then
        yarn add ${args[3]} ${args[4]}
    # if we are not installing any package, install all depencencies
    else
        yarn install
    fi
fi

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

No branches or pull requests

3 participants