nervous-systems / kvlt

Multi-target Clojure/script HTTP client
The Unlicense
69 stars 8 forks source link

wrong path for bluebird #18

Open Hidfeel opened 7 years ago

Hidfeel commented 7 years ago
fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'c:\work\laconic\js-src\js-srcluebird.js'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.nodeGlobalRequire (c:\work\laconic\js-src\goog\bootstrap\nodejs.js:85:26)
    at Object.cljs$core$load_file [as load_file] (c:\work\laconic\js-src\cljs\core.js:324:13)
    at Object.<anonymous> (c:\work\laconic\js-src\promesa\core.js:4:11)
    at Module._compile (module.js:570:32)

looks like something wrong with promesa

my compiler config

  :cljsbuild {
    :builds [{
        ; The path to the top-level ClojureScript source directory:
        :source-paths ["src"]
        ; The standard ClojureScript compiler options:
        ; (See the ClojureScript compiler documentation for details.)
        :compiler {
          :main "main.index"
          :output-dir "js-src"
          :output-to "js-src/main.js"  ; default: target/cljsbuild-main.js
          :asset-path "/"
          :optimizations :none
          :target :nodejs
          :pretty-print true
          :source-map true
          ; :source-map "js-src/main.js.map"
          }}
moea commented 7 years ago

@Hidfeel I don't have much windows development experience, and I haven't seen this particular issue. Could you try with kvlt 0.1.4-SNAPSHOT, as it depends on a newer version of promesa?

moea commented 7 years ago

Also the dependencies section of your project file would be great.

Hidfeel commented 7 years ago
  :plugins [[lein-cljsbuild "1.1.4"] [lein-resource "16.9.1"] ]
  :dependencies [
    [org.clojure/clojurescript "1.9.293"] 
    [org.clojure/clojure "1.8.0"]
    [io.nervous/kvlt "0.1.4-SNAPSHOT"]
  ]

0.1.4-SNAPSHOT also has the same problem, tomorrow I'll try on mac, and add more info

moea commented 7 years ago

Cool. I'd be curious to know if you see this issue with the 1.8 series of cljs, e.g. 1.8.51

Hidfeel commented 7 years ago

I test it on mac and use cljs@1.8.51 ,problem is still here. project is here

moea commented 7 years ago

Thanks, will look today

On 23 Nov 2016 03:42, "Hidfeel" notifications@github.com wrote:

I test it on mac and use cljs@1.8.51 ,problem is still here. project is here https://github.com/Hidfeel/cljs-test

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nervous-systems/kvlt/issues/18#issuecomment-262428997, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYuK1IySYEbDekTTj1WXAbD_k1pS777ks5rA7YzgaJpZM4K5Ycb .

moea commented 7 years ago

@Hidfeel A couple of things:

This isn't specific to your problem above, but with cljs projects which don't bundle their js dependencies (like kvlt), lein-npm is required so that lein deps fetches the node modules. Because plugin dependencies are not transitive, you need to explicitly add [lein-npm "0.6.2"] to your project's :plugins vector. Run lein deps once, and the node deps will be fetched. This won't fix your problem, but will fix issues you would likely see later on at runtime (or else allow you to skip having to globally install the dependencies, if that's what you did).

:asset-path is messing with the relative paths - I've never used that feature, but if you remove it and rebuild, then node js-src/main.js from the project directory will fix your problem

Hidfeel commented 7 years ago

thanks for your kindness to help me try to solve my problem. I would like to use package.json to manage js dependences ,because my deploy env is something like heroku ,package.json is necessary .lein-npm is a nice choice if I dont need package.json, I will look deeper in it. The project is try to show that my without any other libs, and as you say , dependencies is not the main problem.

why I use :asset-path ,that is I hope to complie js in a single dir js-src and run nodejs app in the js-src directly, The point is the package.json and node command line is executing in the js-src and If I want to deploy,I just need to deploy js-src as submodule or anything else , without any other clj and cljs files . If I remove :assert-path I will get other Cannot find module error like:

Error: Cannot find module '/Users/chita/test/cljs-test/js-src/js-src/goog/bootstrap/nodejs.js'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/chita/test/cljs-test/js-src/main.js:19:1)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)

I hope I have show my reason to use :assert-path clearly , and I agree with you that :asset-path mess these deps up

moea commented 7 years ago

OK - I understand why lein npm doesn't make sense if you're managing your own package.json.

I don't know if the issue with the bluebird dependency is to do with promesa, or if it's a more general clojurescript compiler issue.

Hidfeel commented 7 years ago

Nor do I . One of them misunderstand something with :assert-path or other things, promesa I guess. :assert-path is not a option that often be used.