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

local npm install: "no such file or directory node_modules/swagger-editor-dist/" #13

Open
khelkun opened this issue Aug 24, 2017 · 8 comments

Comments

@khelkun
Copy link

khelkun commented Aug 24, 2017

I started to use swagger-editor-live and it does exactly what I was looking for swagger-editor version 3. It works but I had a strange issue that I wanted to report. Sorry if the issue is related to my environment but I don't think it is.

  • I installed swagger-editor-live locally to my project:
    npm install swagger-editor-live --save-dev
  • Then declared this script in my own package.json:
    "swagger:edit": "swagger-editor-live swagger/swagger.yaml --port=8000"
  • Then run it:
    npm run swagger:edit
  • And it complained about missing swagger-editor-dist dependcy in the swagger-editor-dist/node_modules:
Error: ENOENT: no such file or directory, stat '/home/me/myproject/node_modules/swagger-editor-live/node_modules/swagger-editor-dist/swagger-editor.css'
Error: ENOENT: no such file or directory, stat '/home/me/myproject/node_modules/swagger-editor-live/node_modules/swagger-editor-dist/swagger-editor-bundle.js'
Error: ENOENT: no such file or directory, stat '/home/me/myproject/node_modules/swagger-editor-live/node_modules/swagger-editor-dist/swagger-editor-standalone-preset.js'

Actually the only dependency that was existing in /home/me/myproject/node_modules/swagger-editor-live/node_modules/ was commander (weird).
So I did that:

cd /home/me/myproject/node_modules/swagger-editor-live
npm install

And now everything's fine. I just wanted to let you know in case something would be wrong uin the npm released package of swagger-editor-live. If not then please forgive me and thanks for this useful module.

@khelkun
Copy link
Author

khelkun commented Aug 24, 2017

I confirm this issue when installing the swagger-editor-live package locally
But installing it globally works just fine

However I noticed that when I install it locally there's another module installed: /home/me/myproject/node_modules/swagger-editor-dist/
So I guess swagger-editor-live should rely on this locally installed swagger-editor-dist but considering the issue I reported it seems that it expects swagger-editor-dist to be in /home/me/myproject/node_modules/swagger-editor-live/node_modules/swagger-editor-dist

@moon0326
Copy link
Owner

I did not have this issue, but I will double check. Thank you for the report.

@khelkun
Copy link
Author

khelkun commented Aug 28, 2017

Did you remove the global installation of swagger-editor-live npm package before testing it?

this is what my package-lock.json shows:

"swagger-editor-live": {
      "version": "2.1.7",
      "resolved": "https://registry.npmjs.org/swagger-editor-live/-/swagger-editor-live-2.1.7.tgz",
      "integrity": "sha1-oz9+rjTXtoBy3WMGcqCSPXxJRW0=",
      "requires": {
        "commander": "2.11.0",
        "express": "4.15.4",
        "open": "0.0.5",
        "path": "0.12.7",
        "swagger-editor-dist": "3.1.5"
      },
      "dependencies": {
        "commander": {
          "version": "2.11.0",
          "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
          "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ=="
        }
      }
},

@moon0326
Copy link
Owner

Hi @khelkun

I've never tested it as a package of another package (your case). I only tested it as a global package.

I think I know what the issue is.

It looks like swagger-editor-live is looking for "swagger-editor-dist" in an incorrect path.

It should look for "swagger-editor-dist" in your "node_modules", but it's looking for that in /node_modules/swagger-editor-live/node_modules.

I will have patch soon.

Thank you for the report!

@khelkun
Copy link
Author

khelkun commented Aug 28, 2017

That's right, thank you for your time and this package which is really useful to me!

@moon0326
Copy link
Owner

moon0326 commented Sep 1, 2017

@khelkun

Sorry for the delay in the fix.

I've just released 2.1.8 with a fix.

Thank you for the report again!

@khelkun
Copy link
Author

khelkun commented Sep 1, 2017

Thanks! the npm local install works fine now.

If you're interested in this, I tried npm & yarn and for some reason something goes wrong with yarn: it doesn't install swagger-editor-dist package and the yarn.lock file doesn't mention swagger-editor-dist as a dependency of swgger-editor-live. I don't now much about yarn but once again it can be related to my environment,
yarn.lock:

swagger-editor-live@^2.1.8:
  version "2.2.1"
  resolved "https://registry.yarnpkg.com/swagger-editor-live/-/swagger-editor-live-2.2.1.tgz#22eff9bbca0a31defc3caf14d3e6e349226e6c04"
  dependencies:
    commander "^2.9.0"
    connect "^3.6.2"
    open "0.0.5"
    path "^0.12.7"
    serve-static "^1.12.3"

But package-lock.json of npm does mention swagger-editor-dist dependency:

    "swagger-editor-dist": {
      "version": "3.1.5",
      "resolved": "https://registry.npmjs.org/swagger-editor-dist/-/swagger-editor-dist-3.1.5.tgz",
      "integrity": "sha1-CES6hp/B6bd9Em12HVwOBx2IPYg="
    },
    "swagger-editor-live": {
      "version": "2.1.8",
      "resolved": "https://registry.npmjs.org/swagger-editor-live/-/swagger-editor-live-2.1.8.tgz",
      "integrity": "sha1-IwwzrP1Jw53NjwDH8uM5PfGag+Q=",
      "requires": {
        "commander": "2.11.0",
        "express": "4.15.4",
        "open": "0.0.5",
        "path": "0.12.7",
        "swagger-editor-dist": "3.1.5"
      }

@moon0326
Copy link
Owner

moon0326 commented Sep 1, 2017

@khelkun

That's interesting. I should start using yarn instead :) I guess old habit does not go away that easily.

I will try this over the weekend. Thank you for the report! I will leave it open until I figure out yarn issue.

Rickaro pushed a commit to Rickaro/swagger-editor-live that referenced this issue Apr 6, 2020
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

2 participants