Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.42k stars 436 forks source link

npm install works but npm prune throws "Error: Cannot find module 'klaw'" #708

Open awayken opened 7 years ago

awayken commented 7 years ago

I'm using PhantomJS with PhantomCSS. With the release of npm5, I decided to go through and update my projects. With this particular project, npm install works just fine. Here is my output:

C:\Sites\acx\vertical_responsive [feature/npm5 +0 ~2 -0]> npm install                                
npm WARN prefer global colorguard@1.2.0 should be installed with -g                                  

> phantomjs-prebuilt@2.1.7 install C:\Sites\acx\vertical_responsive\node_modules\phantomjs-prebuilt  
> node install.js                                                                                    

Considering PhantomJS found at C:\phantomjs-2.1.1-windows\bin\phantomjs.EXE                          
Found PhantomJS at C:\phantomjs-2.1.1-windows\bin\phantomjs.EXE ...verifying                         
Writing location.js file                                                                             
PhantomJS is already installed on PATH at C:\phantomjs-2.1.1-windows\bin\phantomjs.EXE               

> husky@0.13.4 install C:\Sites\acx\vertical_responsive\node_modules\husky                           
> node ./bin/install.js                                                                              

husky                                                                                                
setting up hooks                                                                                     
done                                                                                                 

added 1044 packages in 48.346s

But, if I run npm prune, PhantomJS throws an error:

C:\Sites\acx\vertical_responsive [feature/npm5 +0 ~2 -0]> npm prune

> phantomjs-prebuilt@2.1.7 install node_modules\phantomjs-prebuilt
> node install.js

module.js:471
    throw err;
    ^

Error: Cannot find module 'klaw'
    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> (C:\Sites\acx\vertical_responsive\node_modules\phantomjs-prebuilt\node_modules\fs-extra\lib\walk\index.js:1:74)
    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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.7 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mrausch\AppData\Roaming\npm-cache\_logs\2017-06-05T16_49_23_055Z-debug.log

This could be some sort of bug in npm, but I'm starting here. Any ideas? What information do you need from me?

awayken commented 7 years ago

I just tried to install a new package to my project, and I got the klaw error above.

C:\Sites\acx\vertical_responsive [feature/npm5 +0 ~2 -0]> npm install gulp-imagemin

> phantomjs-prebuilt@2.1.7 install C:\Sites\acx\vertical_responsive\node_modules\phantomjs-prebuilt
> node install.js

module.js:471
    throw err;
    ^

Error: Cannot find module 'klaw'
    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> (C:\Sites\acx\vertical_responsive\node_modules\phantomjs-prebuilt\node_modules\fs-extra\lib\walk\index.js:1:74)
    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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.7 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mrausch\AppData\Roaming\npm-cache\_logs\2017-06-05T17_04_32_690Z-debug.log

I'm really not sure why PhantomJS is involved in this install command. It's already installed without issue.

frediana commented 7 years ago

Hello,

I noticed the exact same behavior, using NPM5, npm prune && npm i is failing with the same error.

Any idea?

CROSP commented 7 years ago

Got the same error while trying to install the express-winston library. Is there any solution ?

bichotll commented 7 years ago

Got the same problem using https://github.com/saguijs/sagui

awayken commented 7 years ago

I should say that I've since reverted to npm4, and I didn't have these same issues. Even more recently, I've been using Yarn almost exclusively, and I don't see this issue. It very much seems to be a bug of some sort in npm5.

fredbt commented 6 years ago

I'm also having this now.

Steps that I followed: npm install --save react-native-push-notification react-native link <<<------- this triggers the error

This is my config: "react": "16.0.0-alpha.12", "react-native": "^0.46.4",

npm -v 5.0.3

ftprod commented 6 years ago

Adding fs.extra solved the problem for me. in package.json : "fs.extra": "^1.3.2"