stevenvachon / broken-link-checker

Find broken links, missing images, etc within your HTML.
MIT License
1.97k stars 305 forks source link

Error: Cannot find module '../lib-cjs/cli' #176

Closed muescha closed 4 years ago

muescha commented 4 years ago

Describe the bug

Error: Cannot find module '../lib-cjs/cli'

To Reproduce

installed via:

npm install stevenvachon/broken-link-checker -g

check version:

blc --version
internal/modules/cjs/loader.js:800                                                                                                                                      
    throw err;                                                                                                                                                          
    ^                                                                                                                                                                   

Error: Cannot find module '../lib-cjs/cli'                                                                                                                              
Require stack:                                                                                                                                                          
- /Users/muescha/.nvm/versions/node/v12.13.1/lib/node_modules/broken-link-checker/bin/blc                                                                               
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)                                                                                         
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)                                                                                                    
    at Module.require (internal/modules/cjs/loader.js:852:19)                                                                                                           
    at require (internal/modules/cjs/helpers.js:74:18)                                                                                                                  
    at Object.<anonymous> (/Users/muescha/.nvm/versions/node/v12.13.1/lib/node_modules/broken-link-checker/bin/blc:3:1)                                                 
    at Module._compile (internal/modules/cjs/loader.js:959:30)                                                                                                          
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)                                                                                            
    at Module.load (internal/modules/cjs/loader.js:815:32)                                                                                                              
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)                                                                                                    
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {                                                                                               
  code: 'MODULE_NOT_FOUND',                                                                                                                                             
  requireStack: [                                                                                                                                                       
    '/Users/muescha/.nvm/versions/node/v12.13.1/lib/node_modules/broken-link-checker/bin/blc'                                                                           
  ]                                                                                                                                                                     
}  

Expected behavior

no error

Environment:

npm list -g --depth 0
/Users/muescha/.nvm/versions/node/v12.13.1/lib                                                                                                                          
├── broken-link-checker@0.8.0 (github:stevenvachon/broken-link-checker#a08abcdbec91197a7232d720989e6fb608517e46)                                                        
├── gatsby-cli@2.8.13                                                                                                                                                   
└── npm@6.13.6     
which blc
/Users/muescha/.nvm/versions/node/v12.13.1/bin/blc
stevenvachon commented 4 years ago

Looks like you installed the unreleased 0.8 from git (and not npm). In which case, you need to run npm run build.

muescha commented 4 years ago

thx a lot :)

i need to clone it and then npm run build instead of direct npm install?

stevenvachon commented 4 years ago

you'll have to cd into teh dir and run the build script. The previous install should be fine.

muescha commented 4 years ago

thx - i have done so far:

git clone https://github.com/stevenvachon/broken-link-checker.git
cd broken-link-checker 
npm install
npm run build
blc --version
internal/modules/cjs/loader.js:983
  throw err;
  ^

but this works:

./bin/blc --version
0.8.0

now i have to find out how to put it in the "global npm"

muescha commented 4 years ago

or how i can use it globaly

stevenvachon commented 4 years ago
npm install -g github:stevenvachon/broken-link-checker
cd /path/to/global-npm-packages/broken-link-checker
npm run build
muescha commented 4 years ago

ah - this is also possible. thx a lot :)

PS: as workaround i will use the absolute path to the blc executable on my local path ...