zkat / npx

execute npm package binaries (moved)
https://github.com/npm/npx
Other
2.63k stars 105 forks source link

vue-cli with npx #112

Closed josephrexme closed 7 years ago

josephrexme commented 7 years ago

The vue-cli is installed as npm install vue-cli but it registers a binary as vue. Similar to grunt. I tried to run

$ npx vue init webpack project

and that came back with unknown command, then I tried with vue-cli

$ npx vue-cli init webpack project

which displayed like it was processing but eventually did nothing at all. How can npx be used in such cases?

posva commented 7 years ago

To add to the subject, it does work for me, but otherwise, I think we can also do npx -p vue-cli vue init webpack project (from the readme)

josephrexme commented 7 years ago

Confirmed it works as npx vue-cli init webpack project. I omitted init in my previous test

ndabAP commented 6 years ago

Use npx @vue/cli create project for the new CLI.

pashute commented 6 years ago

@ndabAP Julian, I tried npx @vue/cli create noamDataAdmin and first get path must be a string. Received undefined then after churning some more it gives: invalid project name "noamDataAdmin"

I now tried npx @vue/cli create webpack noamDataAdmin again I got path must be a string. Received undefined but this time it opened a window and asked me to choose how I want to create the project in the directory webpack (I think it's using the project name webpack).

finally, I changed to npx @vue/cli create noam-data-admin and although I still get the path must be it runs ok opens the window with the yarn/npm question and finishes ok after I chose the default.

ndabAP commented 6 years ago

@pashute tried it again with project and it worked. Try: noam-data-ddmin. I guess this is because of git.

pashute commented 6 years ago

yes that was my mistake. I edited my answer. the path must be is inherent to npx and discussed eslewhere. The problem was in the project name due to my lack of knowledge about VUE project names.

BryanAdamss commented 5 years ago

Use npx @vue/cli create project for the new CLI.

Its awesome :)

mattwr18 commented 5 years ago

@josephrexme thanks for creating this issue, it's really nice when you are dealing with some error that someone took the time to create an issue so that others in the future can find it in the future and get some support!

I am trying to run npx @vue/cli create project and I'm getting this error

npx @vue/cli create client                                                                  11:48:24
npm ERR! Maximum call stack size exceeded

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mattwr18/.npm/_logs/2019-03-17T14_49_52_341Z-debug.log
Install for @vue/cli@latest failed with code 1

I've checked the logs and this seems like the relevant output

/home/mattwr18/go/bin:/home/mattwr18/.asdf/installs/nodejs/10.15.1/.npm/bin
18946 verbose lifecycle protobufjs@6.8.8~postinstall: CWD: /home/mattwr18/.npm/_npx/27949/lib/node_modules/@vue/cli/node_modules/protobufjs
18947 silly lifecycle protobufjs@6.8.8~postinstall: Args: [ '-c', 'node scripts/postinstall' ]
18948 silly lifecycle protobufjs@6.8.8~postinstall: Returned: code: 126  signal: null
18949 info lifecycle protobufjs@6.8.8~postinstall: Failed to exec postinstall script
18950 timing action:postinstall Completed in 158ms
18951 verbose unlock done using /home/mattwr18/.npm/_locks/staging-c1372a2f8d1280e1.lock for /home/mattwr18/.npm/_npx/27949/lib/node_modules/.staging
18952 timing stage:rollbackFailedOptional Completed in 827ms
18953 timing stage:runTopLevelLifecycles Completed in 11210ms
18954 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/@vue/cli/node_modules/fsevents):
18955 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
18956 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
18956 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
18956 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
18956 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
18957 verbose stack RangeError: Maximum call stack size exceeded
18957 verbose stack     at RegExp.test (<anonymous>)
18957 verbose stack     at isDepOptional (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:405:45)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:414:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)
18957 verbose stack     at failedDependency (/home/mattwr18/.asdf/installs/nodejs/10.15.1/lib/node_modules/npm/lib/install/deps.js:430:9)

I ended up trying to install it globally with npm, which failed with the same error, but also had output saying I needed to set a node version. After having run asdf global nodejs 10.15.1, I was able to successfully use the npx @vue/cli create project command.

Hope this helps someone in the future