halfzebra/create-elm-app

create-elm-app as a local dependency

Closed this issue · 4 comments

Is this a bug report?

No. Probably create-elm-app as a project local dependency is not supported anymore, but the use case can be supported with a one line change. I'll make a pull request following this issue.

Environment

  1. node -v: v8.11.2
  2. npm -v: 6.4.1
  3. yarn --version (if you use Yarn): I don't use it
  4. npm ls create-elm-app -g (if you haven’t ejected): create-elm-app@2.0.3 (same version in devDependencies of the project)

Then, specify:

  1. Operating system: macOS High Sierra 10.13.6
  2. Browser and version (if relevant): not relevant

Steps to Reproduce

(Write your steps here:)

  1. Create an app with create-elm-app foo
  2. cd foo
  3. npm i -D create-elm-app
  4. Add elm-app start to scripts -> start in package.json
  5. npm start

Expected Behavior

The application starts without an error.

Actual Behavior

I got the following error.

Starting the development server...

Running /Users/shuhei/work/elm/create-elm-app-test/node_modules/create-elm-app/node_modules/.bin/elm make /Users/shuhei/work/elm/create-elm-app-test/src/Main.elm --debug --output /var/folders/zj/lxpw_yhd1411_d7p078bxznm0000gn/T/11888-5281-1dcflm2.xk4c.js
/Users/shuhei/work/elm/create-elm-app-test/node_modules/node-elm-compiler/index.js:103
      .on('error', function(err) { throw(err); });
                                   ^

Error: spawn /Users/shuhei/work/elm/create-elm-app-test/node_modules/create-elm-app/node_modules/.bin/elm ENOENT
    at _errnoException (util.js:992: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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @shuhei/create-elm-app-test@1.0.0 start: `elm-app start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @shuhei/create-elm-app-test@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/shuhei/.npm/_logs/2018-09-08T11_56_14_860Z-debug.log

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Sorry, I changed my mind. I'll just use this as a global package.

I changed my mind again. I'll leave it to your decision.

Hi @shuhei!

Thanks for the report and for the PR!

I will merge it as I think this use-case should be supported.

Hi @halfzebra! Thanks for merging :D