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

Error on yo webapp Cannot find module 'C:\Program Files\Git\node_modules\yo\lib\cli.js' #530

Closed
karkx opened this issue May 31, 2016 · 11 comments

Comments

@karkx
Copy link

karkx commented May 31, 2016

Hello I have this error while i trying first time generate webapp :

$ yo webapp
module.js:442
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\Git\node_modules\yo\lib\cli.js'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:449:3

System Win 7 Home Premium x64
I have installed node 6.2.0 and dependencies and generator from getting started.

Edit

Here is log from installing yo it seems like its evryhing allright.

$ npm install --global yo
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
C:\Users\User\AppData\Roaming\npm\yo -> C:\Users\User\AppData\Roaming\npm\node_modules\yo\lib\cli.js
C:\Users\User\AppData\Roaming\npm\yo-complete -> C:\Users\User\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js

> yo@1.8.3 postinstall C:\Users\User\AppData\Roaming\npm\node_modules\yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

√ Global configuration file is valid
√ NODE_PATH matches the npm root
√ Node.js version
√ No .bowerrc file in home directory
√ No .yo-rc.json file in home directory
√ npm version

Everything looks all right!
C:\Users\User\AppData\Roaming\npm
`-- yo@1.8.3
  +-- async@1.5.2
  +-- chalk@1.1.3
  | +-- ansi-styles@2.2.1
  | +-- escape-string-regexp@1.0.5
  | +-- has-ansi@2.0.0
  | +-- strip-ansi@3.0.1
  | `-- supports-color@2.0.0
  +-- cli-list@0.1.8
  +-- configstore@1.4.0
  | +-- graceful-fs@4.1.4
  | +-- mkdirp@0.5.1
  | | `-- minimist@0.0.8
  | +-- object-assign@4.1.0
  | +-- os-tmpdir@1.0.1
  | +-- osenv@0.1.3
  | +-- uuid@2.0.2
  | +-- write-file-atomic@1.1.4
  | | +-- imurmurhash@0.1.4
  | | `-- slide@1.1.6
  | `-- xdg-basedir@2.0.0
  +-- cross-spawn-async@2.2.4
  | +-- lru-cache@4.0.1
  | | +-- pseudomap@1.0.2
  | | `-- yallist@2.0.0
  | `-- which@1.2.9
  |   `-- isexe@1.1.2
  +-- figures@1.7.0
  +-- fullname@2.1.0
  | +-- npmconf@2.1.2
  | | +-- config-chain@1.1.10
  | | | `-- proto-list@1.2.4
  | | +-- inherits@2.0.1
  | | +-- ini@1.3.4
  | | +-- nopt@3.0.6
  | | | `-- abbrev@1.0.7
  | | +-- once@1.3.3
  | | | `-- wrappy@1.0.2
  | | +-- semver@4.3.6
  | | `-- uid-number@0.0.5
  | +-- pify@2.3.0
  | `-- pinkie-promise@2.0.1
  |   `-- pinkie@2.0.4
  +-- got@5.6.0
  | +-- create-error-class@3.0.2
  | | `-- capture-stack-trace@1.0.0
  | +-- duplexer2@0.1.4
  | +-- is-plain-obj@1.1.0
  | +-- is-redirect@1.0.0
  | +-- is-retry-allowed@1.0.0
  | +-- is-stream@1.1.0
  | +-- lowercase-keys@1.0.0
  | +-- node-status-codes@1.0.0
  | +-- parse-json@2.2.0
  | | `-- error-ex@1.3.0
  | |   `-- is-arrayish@0.2.1
  | +-- read-all-stream@3.1.0
  | +-- readable-stream@2.1.4
  | | +-- buffer-shims@1.0.0
  | | +-- core-util-is@1.0.2
  | | +-- isarray@1.0.0
  | | +-- process-nextick-args@1.0.7
  | | +-- string_decoder@0.10.31
  | | `-- util-deprecate@1.0.2
  | +-- timed-out@2.0.0
  | +-- unzip-response@1.0.0
  | `-- url-parse-lax@1.0.0
  |   `-- prepend-http@1.0.4
  +-- humanize-string@1.0.1
  | `-- decamelize@1.2.0
  +-- inquirer@0.11.4
  | +-- ansi-escapes@1.4.0
  | +-- ansi-regex@2.0.0
  | +-- cli-cursor@1.0.2
  | | `-- restore-cursor@1.0.1
  | |   `-- exit-hook@1.1.1
  | +-- cli-width@1.1.1
  | +-- readline2@1.0.1
  | | +-- code-point-at@1.0.0
  | | +-- is-fullwidth-code-point@1.0.0
  | | `-- mute-stream@0.0.5
  | +-- run-async@0.1.0
  | +-- rx-lite@3.1.2
  | +-- string-width@1.0.1
  | `-- through@2.3.8
  +-- insight@0.7.0
  | +-- inquirer@0.10.1
  | +-- lodash.debounce@3.1.1
  | | `-- lodash._getnative@3.9.1
  | +-- os-name@1.0.3
  | | +-- osx-release@1.1.0
  | | | `-- minimist@1.2.0
  | | `-- win-release@1.1.1
  | |   `-- semver@5.1.0
  | +-- request@2.72.0
  | | +-- aws-sign2@0.6.0
  | | +-- aws4@1.4.1
  | | +-- bl@1.1.2
  | | | `-- readable-stream@2.0.6
  | | +-- caseless@0.11.0
  | | +-- combined-stream@1.0.5
  | | | `-- delayed-stream@1.0.0
  | | +-- extend@3.0.0
  | | +-- forever-agent@0.6.1
  | | +-- form-data@1.0.0-rc4
  | | +-- har-validator@2.0.6
  | | | +-- commander@2.9.0
  | | | | `-- graceful-readlink@1.0.1
  | | | `-- is-my-json-valid@2.13.1
  | | |   +-- generate-function@2.0.0
  | | |   +-- generate-object-property@1.2.0
  | | |   | `-- is-property@1.0.2
  | | |   `-- jsonpointer@2.0.0
  | | +-- hawk@3.1.3
  | | | +-- boom@2.10.1
  | | | +-- cryptiles@2.0.5
  | | | +-- hoek@2.16.3
  | | | `-- sntp@1.0.9
  | | +-- http-signature@1.1.1
  | | | +-- assert-plus@0.2.0
  | | | +-- jsprim@1.2.2
  | | | | +-- extsprintf@1.0.2
  | | | | +-- json-schema@0.2.2
  | | | | `-- verror@1.3.6
  | | | `-- sshpk@1.8.3
  | | |   +-- asn1@0.2.3
  | | |   +-- assert-plus@1.0.0
  | | |   +-- dashdash@1.13.1
  | | |   | `-- assert-plus@1.0.0
  | | |   +-- ecc-jsbn@0.1.1
  | | |   +-- getpass@0.1.6
  | | |   | `-- assert-plus@1.0.0
  | | |   +-- jodid25519@1.0.2
  | | |   +-- jsbn@0.1.0
  | | |   `-- tweetnacl@0.13.3
  | | +-- is-typedarray@1.0.0
  | | +-- isstream@0.1.2
  | | +-- json-stringify-safe@5.0.1
  | | +-- mime-types@2.1.11
  | | | `-- mime-db@1.23.0
  | | +-- node-uuid@1.4.7
  | | +-- oauth-sign@0.8.2
  | | +-- qs@6.1.0
  | | +-- stringstream@0.0.5
  | | `-- tunnel-agent@0.4.3
  | `-- tough-cookie@2.2.2
  +-- lodash@3.10.1
  +-- meow@3.7.0
  | +-- camelcase-keys@2.1.0
  | | `-- camelcase@2.1.1
  | +-- loud-rejection@1.3.0
  | | +-- array-find-index@1.0.1
  | | `-- signal-exit@2.1.2
  | +-- map-obj@1.0.1
  | +-- minimist@1.2.0
  | +-- normalize-package-data@2.3.5
  | | +-- hosted-git-info@2.1.5
  | | +-- is-builtin-module@1.0.0
  | | | `-- builtin-modules@1.1.1
  | | `-- validate-npm-package-license@3.0.1
  | |   +-- spdx-correct@1.0.2
  | |   | `-- spdx-license-ids@1.2.1
  | |   `-- spdx-expression-parse@1.0.2
  | |     `-- spdx-exceptions@1.0.4
  | +-- redent@1.0.0
  | | +-- indent-string@2.1.0
  | | `-- strip-indent@1.0.1
  | `-- trim-newlines@1.0.0
  +-- npm-keyword@4.2.0
  | `-- registry-url@3.1.0
  +-- opn@3.0.3
  +-- package-json@2.3.2
  | +-- rc@1.1.6
  | | +-- deep-extend@0.4.1
  | | +-- minimist@1.2.0
  | | `-- strip-json-comments@1.0.4
  | `-- semver@5.1.0
  +-- parse-help@0.1.1
  | `-- execall@1.0.0
  |   `-- clone-regexp@1.0.0
  |     +-- is-regexp@1.0.0
  |     `-- is-supported-regexp-flag@1.0.0
  +-- read-pkg-up@1.0.1
  | +-- find-up@1.1.2
  | | `-- path-exists@2.1.0
  | `-- read-pkg@1.1.0
  |   +-- load-json-file@1.1.0
  |   | `-- strip-bom@2.0.0
  |   |   `-- is-utf8@0.2.1
  |   `-- path-type@1.1.0
  +-- repeating@2.0.1
  | `-- is-finite@1.0.1
  |   `-- number-is-nan@1.0.0
  +-- root-check@1.0.0
  | +-- downgrade-root@1.1.0
  | | +-- default-uid@1.0.0
  | | `-- is-root@1.0.0
  | `-- sudo-block@1.2.0
  |   `-- is-docker@1.0.1
  +-- sort-on@1.3.0
  | +-- arrify@1.0.1
  | `-- dot-prop@2.4.0
  |   `-- is-obj@1.0.1
  +-- string-length@1.0.1
  +-- tabtab@1.3.2
  | +-- debug@2.2.0
  | | `-- ms@0.7.1
  | +-- inquirer@1.0.3
  | | +-- cli-width@2.1.0
  | | +-- lodash@4.13.1
  | | +-- mute-stream@0.0.6
  | | +-- run-async@2.2.0
  | | | `-- is-promise@2.1.0
  | | `-- rx@4.1.0
  | +-- minimist@1.2.0
  | `-- npmlog@2.0.4
  |   +-- ansi@0.3.1
  |   +-- are-we-there-yet@1.1.2
  |   | `-- delegates@1.0.0
  |   `-- gauge@1.2.7
  |     +-- has-unicode@2.0.0
  |     +-- lodash.pad@4.4.0
  |     | +-- lodash._baseslice@4.0.0
  |     | +-- lodash._basetostring@4.12.0
  |     | `-- lodash.tostring@4.1.3
  |     +-- lodash.padend@4.5.0
  |     `-- lodash.padstart@4.5.0
  +-- titleize@1.0.0
  +-- update-notifier@0.6.3
  | +-- boxen@0.3.1
  | | +-- filled-array@1.1.0
  | | `-- widest-line@1.0.0
  | +-- configstore@2.0.0
  | +-- is-npm@1.0.0
  | +-- latest-version@2.0.0
  | `-- semver-diff@2.1.0
  |   `-- semver@5.1.0
  +-- user-home@2.0.0
  | `-- os-homedir@1.0.1
  +-- yeoman-character@1.1.0
  | `-- supports-color@3.1.2
  |   `-- has-flag@1.0.0
  +-- yeoman-doctor@2.1.0
  | +-- bin-version-check@2.1.0
  | | +-- bin-version@1.0.4
  | | | `-- find-versions@1.2.1
  | | |   `-- semver-regex@1.0.0
  | | +-- minimist@1.2.0
  | | `-- semver-truncate@1.1.0
  | |   `-- semver@5.1.0
  | +-- each-async@1.1.1
  | | +-- onetime@1.1.0
  | | `-- set-immediate-shim@1.0.1
  | +-- log-symbols@1.0.2
  | +-- object-values@1.0.0
  | +-- semver@5.1.0
  | `-- twig@0.8.9
  |   +-- minimatch@3.0.0
  |   | `-- brace-expansion@1.1.4
  |   |   +-- balanced-match@0.4.1
  |   |   `-- concat-map@0.0.1
  |   `-- walk@2.3.9
  |     `-- foreachasync@3.0.0
  +-- yeoman-environment@1.6.1
  | +-- diff@2.2.2
  | +-- globby@4.1.0
  | | +-- array-union@1.0.1
  | | | `-- array-uniq@1.0.2
  | | `-- glob@6.0.4
  | |   +-- inflight@1.0.5
  | |   `-- path-is-absolute@1.0.0
  | +-- grouped-queue@0.3.2
  | +-- inquirer@1.0.3
  | | +-- cli-width@2.1.0
  | | +-- mute-stream@0.0.6
  | | `-- run-async@2.2.0
  | +-- lodash@4.13.1
  | +-- mem-fs@1.1.3
  | | +-- through2@2.0.1
  | | | +-- readable-stream@2.0.6
  | | | `-- xtend@4.0.1
  | | +-- vinyl@1.1.1
  | | | +-- clone@1.0.2
  | | | +-- clone-stats@0.0.1
  | | | `-- replace-ext@0.0.1
  | | `-- vinyl-file@2.0.0
  | |   `-- strip-bom-stream@2.0.0
  | |     `-- first-chunk-stream@2.0.0
  | +-- text-table@0.2.0
  | `-- untildify@2.1.0
  `-- yosay@1.1.1
    +-- pad-component@0.0.1
    +-- taketalk@1.0.0
    | +-- get-stdin@4.0.1
    | `-- minimist@1.2.0
    `-- wrap-ansi@2.0.0
@kevva
Copy link
Member

kevva commented Jun 1, 2016

Try upgrading to 1.8.4 and report back if it works. Might be some issue during publishing that caused that file not to be published. It has happened before and is most likely due to Node 6/npm. See https://github.com/SamVerschueren/npm-publish-index-test,

@karkx
Copy link
Author

karkx commented Jun 2, 2016

I have installed yo 1.8.4 but still same error occurs. Also I use nvm to downgraed node to 5.7.0 which i use on pc at home but still same error occurs. Also before posting this error I have trying run it on node 4.4.5 but still same error.
image

@SpacemanPete
Copy link

SpacemanPete commented Jul 20, 2016

I have the same exact error message:

$ yo
module.js:327
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\Git\node_modules\yo\lib\cli.js'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3

I've uninstalled and reinstalled Node (4.4.7) and npm (3.10.5) from scratch and still get the

I've triple checked my PATH variable and it looks fine.

Just checked on a hunch and I'm able to run yo fine in windows cmd.exe prompt, but Git Bash is reporting that error. Makes me think that Git Bash is not able to use the PATH properly.

I started getting this error right after upgrading node and npm a few minor poitn versions. I tried an uninstall and reinstall to no avail.

Still working on a fix. Thoughts anyone?

@bruceCzK
Copy link

bruceCzK commented Sep 9, 2016

I think I managed to solve this problem by using symlink,
it is a little tricky and does not entirely solve it, but it works.

Run command below in your cmd at administrator mode
C:\Program Files\Git>mklink /D node_modules %USERPROFILE%\AppData\Roaming\npm\node_modules

%USERPROFILE%\AppData\Roaming\npm\node_modules
Replace this is with your global node_modules path.

@ChadCrank
Copy link

I'm having the same issue, I'm using powershell and command line for the user who wants this.

@tabaresjc
Copy link

I was experiencing the same problem.

When I updated node using Windows Installer, the installer created a second repository of Node Modules on ProgramFiles, when the original was at %USERPROFILE%\AppData\Roaming\npm\

But the Window PATH was still having the OLD one %USERPROFILE%\AppData\Roaming\npm
So I duly replaced the OLD path with the new one on ProgramFiles, and the problem was fixed

@jfaquinojr
Copy link

@jctt1983: Thank you, this fixed my issue.

@silvenon
Copy link
Member

silvenon commented Nov 5, 2016

@kb-git did any of the provided solutions fix your problem?

@silvenon
Copy link
Member

Closing due to inactivity. Will reopen if new info is provided. 😉

@rbosneag
Copy link

I have the same error trying a derived generator. Already upgraded node, npm and yo, installed globally the ansi-regex module but all to no avail.

Here is my error:

readline.js:982
            throw err;
            ^

Error: Cannot find module 'ansi-regex'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-cg-angular15/node_modules/yeoman-generator/node_modules/chalk/node_modules/strip-ansi/index.js:2:38)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

@silvenon
Copy link
Member

@rbosneag I believe you're using generator-cg-angular15, not generator-webapp. Correct me if I'm wrong.

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

9 participants