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

cannot find module npm/bin/npm/npm-cli.js #17

Closed
dannyfritz opened this issue Apr 29, 2016 · 5 comments · Fixed by #19
Closed

cannot find module npm/bin/npm/npm-cli.js #17

dannyfritz opened this issue Apr 29, 2016 · 5 comments · Fixed by #19

Comments

@dannyfritz
Copy link
Contributor

I cannot get npm install to run.

  • Windows 10 x64
  • Node v5.10.1
  • Atom 1.7.3

When I hit CTRLALTB, I get this error:

module.js:341
    throw err;
    ^

Error: Cannot find module 'C:\Users\Danny\Dev\handmade-quake-js\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:146:18)

    at node.js:404:3

I made sure the only path I had in PATH related to node or npm was my node path.

Any advice on how to get atom-build-npm-apm to find my npm.cmd file?

@noseglid
Copy link
Member

Where do you get this error? In the build panel or as a notification (popup in Atom)?
How did you install npm?

Looking at the error message, it seems to be the other way around; npm.cmd is found, but it (which really is just a wrapper to run a node script) can't find its script (npm-cli.js).

@dannyfritz
Copy link
Contributor Author

dannyfritz commented Apr 29, 2016

Shows up in the build panel when i try to run any npm command such as npm install. I install node with choco, which should just be a standard install in Windows. npm works great through my command prompt. npm v3.7.0

You are guessing the wrong npm path is being created in the npm.cmd file? It becomes relative to where Atom is running instead of where node is which makes me suspicious it is apm or something. Not really sure.

@noseglid
Copy link
Member

noseglid commented Apr 29, 2016

I'm confident that build correctly finds a npm.cmd, however from there things seems flakey.
If you create an .atom-build.yml file containing only cmd: doesnotexist, then build will complain that doesnotexist doesn't exist :). It will print the PATH it's using. Make sure that there are no other npm.cmd on the path (Especially somewhere in C:\Users\Danny\Dev\...).

@dannyfritz
Copy link
Contributor Author

It is finding the correct npm.cmd. But apparently on Windows, it relies on %~dp0 to find node, but %~dp0 is being set to my project's cwd which ends up not finding node.

I'll poke around further.

@dannyfritz
Copy link
Contributor Author

Alright, figured it out. The package is trying to be a little too smart. At some point along the line, atom-build switched to cross-spawn-async which does not want commands to end in .cmd. Simply removing the Windows specific code around appending .cmd fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants