node version is v8.9.1
npm version is 5.5.1
vue-cli version is 2.9.2
if i initialize a vue project like:
vue init webpack testproject
and follow the prompts to configure, then it show err:
? Project name test
? Project description A Vue.js project
? Author
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm
   vue-cli 路 Generated "test".
# Installing project dependencies ...
# ========================
events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: spawn npm ENOENT
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Same, failing on OSX 10.11.6.
node version is v8.9.3
npm version is 5.5.1
vue-cli version is 2.9.2
Seemed to just fail on npm install. After doing a manual npm install and checking it out things seem to be working.
It work fine on OSX 10.12.6
the node version, npm version, vue-cli version all is same to you
but everything is work fine.
the same error, node version 7.5.0, newest vue-cli version,
you can choose 'NO, I will handle that myself' as a workaround
the same error, node version 7.9.0, newest vue-cli version
Should we runnpm installfor you after the project has been created? (recommended)
choose :NO, I will handle that myself
? Should we run `npm install` for you after the project has been created? (recommended)
   Yes, use NPM
   Yes, use Yarn
>  No, I will handle that myself
on this step choose :
> No, I will handle that myself
after the project has been created, run
npm install
as administrator to install dependencies.
after this, run 
npm run dev
is work fine
the same error,but it can work after run npm run dev
There is also an issue in the npm repo https://github.com/npm/npm/issues/19374 about the same thing.
The issue is that when you provide a name to create a directory, like so
vue init webpack myproject
...
Instead of using the current directory, like so
mkdir myproject
cd myproject
vue init webpack
...
When you then elect to have scaffolding restore your packages (whether through npm or yarn), you are not in the project directory, but above it, so the package install/restore command fails. The workaround works because it skips the package install/restore command. The _fix_ (if you like) would be for vue-cli to change into the directory that it created (when a name is provided) before running the package install/restore command.
Hi guys,
I'm the one responsible for that new feature of the template (see: https://github.com/vuejs-templates/webpack/pull/1133). I tested in throughly on OS X, and @sudo-suhas did on windows.
However, since we can't test all version combinations of OS's and node/npm, errors can happen, so sorry about that and thanks for your patience.
One thing we can immediately improve is the error handling. This error is not "fatal" - all people have to do is run npm install themselves. So I will add a nice error message explaining that to users.
As to the original source of the problem, I'm a bit dumbfounded for the moment.
When you then elect to have scaffolding restore your packages (whether through npm or yarn), you are not in the project directory, but above it, so the package install/restore command fails
That would be weird - being in the wrong directory should lead to an error on OSX as well, but doesn't (for me).
I also think I set the cwd for the npm call to the right directory here:
https://github.com/vuejs-templates/webpack/blob/develop/meta.js#L155-L158
Since this issue is caused by code in the webpack template, not the CLI, have opened an issue there (see: https://github.com/vuejs-templates/webpack/issues/1168) - further discussion should be taking pace there as well.
Therefore I will lock this issue, but keep it open for others with the same problem until it's fixed. It will be closed when the problem is solved in the template repo.
There is also an issue in the npm repo npm/npm#19374 about the same thing.
The problem we are seeing here is very likely our fault, not npm's. That ticket should be closed.
This should be fixed now with https://github.com/vuejs-templates/webpack/pull/1170
Most helpful comment
you can choose 'NO, I will handle that myself' as a workaround