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 'stringstream' #987

Closed
reflexdemon opened this issue Oct 13, 2016 · 16 comments
Closed

Cannot find module 'stringstream' #987

reflexdemon opened this issue Oct 13, 2016 · 16 comments

Comments

@reflexdemon
Copy link

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
While install phantomjs there is a delay and fails with error : Cannot find module 'stringstream'
If the current behavior is a bug, please provide the steps to reproduce.
I am using this package.json https://github.com/reflexdemon/ng-gulp/blob/master/package.json
While trying to delete the node_modules folder and try to do the yarn install I get the following issue

$ yarn install
yarn install v0.15.1
warning ng-gulp@0.1.0: Dependency "url" listed in "devDependencies" is the name of a built-in module
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
warning lodash@2.4.2: The engine "rhino" appears to be invalid.
warning lodash@1.0.2: The engine "rhino" appears to be invalid.
[3/4] 🔗  Linking dependencies...
warning Unmet peer dependency "chai@*".
warning Unmet peer dependency "mocha@*".
[4/4] 📃  Building fresh packages...
[1/2] ⠐ ws
[2/2] ⠐ phantomjs
[-/2] ⠐ waiting...
[-/2] ⠐ waiting...
error /Users/loginuser/Development/Workspace/local/ng-gulp/node_modules/phantomjs: Command failed.
Exit code: 1
Command: sh
Arguments: -c node install.js
Directory: /Users/loginuser/Development/Workspace/local/ng-gulp/node_modules/phantomjs
Output:
module.js:457
    throw err;
    ^

Error: Cannot find module 'stringstream'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/loginuser/Development/Workspace/local/ng-gulp/node_modules/phantomjs/node_modules/request/request.js:14:20)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at SpawnError (/Users/loginuser/.yarn/lib/errors.js:18:1)
    at ChildProcess.proc.on.code (/Users/loginuser/.yarn/lib/util/child.js:107:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

What is the expected behavior?
I see errors only on the first run. To my surprise while trying to run yarn install for the second time it completes successfully. This looks like a caching issue on the yarn that needs to be checked.

$ yarn install
yarn install v0.15.1
warning ng-gulp@0.1.0: Dependency "url" listed in "devDependencies" is the name of a built-in module
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
warning lodash@2.4.2: The engine "rhino" appears to be invalid.
warning lodash@1.0.2: The engine "rhino" appears to be invalid.
[3/4] 🔗  Linking dependencies...
warning Unmet peer dependency "chai@*".
warning Unmet peer dependency "mocha@*".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 4.03s.

Please mention your node.js, yarn and operating system version.

$ node -v
v6.5.0
$ npm -v
3.10.3
$ yarn -v
yarn install v0.15.1
warning ng-gulp@0.1.0: Dependency "url" listed in "devDependencies" is the name of a built-in module
success Already up-to-date.
✨  Done in 0.12s.
System Version: OS X 10.10.5 (14F27)
Kernel Version: Darwin 14.5.0
@masimplo
Copy link

There is something peculiar going on with phantomjs and yarn. On a clean project I do yarn add phantomjs and it works and then do yarn outdated and I get

yarn outdated v0.15.1
Package   Current          Wanted Latest
phantomjs 2.1.7+deprecated 2.1.7  2.1.7
✨  Done in 0.68s.

@raymondfeng
Copy link

I'm seeing a similar issue with yarn global add strongloop. Please note npm i -g strongloop is fine.

yarn global add strongloop
yarn global v0.15.1
warning No license field
[1/4] 🔍  Resolving packages...
warning strongloop > node-inspector > glob > minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning strongloop > strong-arc > strong-mesh-client > browserify > glob > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] 🚚  Fetching packages...
warning lodash@2.4.2: The engine "rhino" appears to be invalid.
warning punycode@1.2.4: The engine "rhino" appears to be invalid.
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[-/5] ⠠ waiting...
[2/5] ⠠ ws
[3/5] ⠠ strong-agent
[4/5] ⠠ strong-mesh-client
error /Users/rfeng/.yarn-cache/.global/node_modules/strong-mesh-client: Command failed.
Exit code: 1
Command: sh
Arguments: -c node proxy/build-client.js
Directory: /Users/rfeng/.yarn-cache/.global/node_modules/strong-mesh-client
Output:
module.js:471
    throw err;
    ^

Error: Cannot find module 'JSONStream'
    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> (/Users/rfeng/.yarn-cache/.global/node_modules/browser-pack/index.js:1:80)
    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)
    at SpawnError (/Users/rfeng/.nvm/versions/node/v6.8.0/lib/node_modules/yarn/lib/errors.js:18:1)
    at ChildProcess.proc.on.code (/Users/rfeng/.nvm/versions/node/v6.8.0/lib/node_modules/yarn/lib/util/child.js:107:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
info Visit http://yarnpkg.com/en/docs/cli/global for documentation about this command.

@kaicataldo
Copy link
Contributor

kaicataldo commented Oct 13, 2016

Scratch that - looks like the package is still missing.

FWIW, I'm getting the exact same issue described in the original issue and running yarn install a second time seems to install correctly.

@alexpelan
Copy link

We were able to fix this by updating our package that had phantomjs as a dependency.

Previously, we were using grunt-contrib-jasmine 0.9.2, which depended on grunt-lib-phantomjs ^0.7.1. , which is dependent on phantomjs ^1.9.15

We upgraded to grunt-contrib-jasmine latest@1.0.3 -> grunt-lib-phantomjs ^1.0.0 -> phantomjs-prebuilt: ^2.1.3

So, perhaps the old phantomjs package doesn't play nicely with yarn (they changed the name to phantomjs-prebuilt at some point).

Hopefully this helps some of you.

@cheapsteak
Copy link

Ran into the same issue
We have different dependencies and updating them didn't work
Not ideal, but manually adding stringstream to the project's devDependencies worked

@markstos
Copy link
Contributor

PhantomJS 1.9 was released over 3 years ago. yarn installs the latest versions of PhantomJS fine via phantomjs-prebuilt. Because the underlying rendering engine in Phantom would be much newer in the latest releases, you can expect the renders to be more compatible as well.

If you are running into this issue, please take it as opportunity to modernize your dependency chain, or encourage the upstream modules that you use to modernize their dependency chain.

Yes, ideally the yarn project could install this old module since npm does, but there are also more interesting projects to work on then creating compatibility with a rather outdated module which has a newer version published that doesn't have problems.

@kaicataldo
Copy link
Contributor

kaicataldo commented Oct 17, 2016

Edit: Actually, upgrading to the newest version of yarn seems to fix this for me!

@markstos I'm seeing this problem with the latest version of phantomjs-prebuilt.

@markstos
Copy link
Contributor

@kaicataldo, great. It just passed for me with yarn 0.15.1 and phantom-prebuilt 2.1.0.

@reflexdemon
Copy link
Author

Works great now!!!

$ rm -rf node_modules

$ yarn
yarn install v0.16.0
warning ng-gulp@0.1.0: Dependency "url" listed in "devDependencies" is the name of a built-in module
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning Unmet peer dependency "chai@*".
warning Unmet peer dependency "mocha@*".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
...


✨  Done in 17.16s.
``

@reflexdemon
Copy link
Author

This can be closed now.

@markstos
Copy link
Contributor

I confirmed even old versions of phantomjs can now be installed as well:

   yarn add phantomjs@1.9.7-15

If if you can't or don't want to upgrade to phantomjs-prebuilt (using Phantom 2.0), it seems the latest version of the 1.x series works as well.

@wyze
Copy link
Member

wyze commented Oct 24, 2016

Closing as everyone reports this is working now.

@wyze wyze closed this as completed Oct 24, 2016
@wyze wyze removed the needs triage label Nov 10, 2016
@jkulak
Copy link

jkulak commented Nov 25, 2016

I had this problem after installing yarn locally with npm

$ npm install yarn
$ ./node_modules/.bin/yarn add express --save --verbose

Yarn, in the "removing unused files" phase, was simply deleting its own files, therefore resulting in File not found errors and being able to finish my tasks 🙄.

Installing yarn with a -g option (or using any other method listed on the yarn website), solved my issue.

@juliocanares
Copy link

I am having this problem, using exceljs https://www.npmjs.com/package/exceljs
this is the error I got

module.js:472
    throw err;
    ^
Error: Cannot find module './doc/workbook'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)

@markstos
Copy link
Contributor

markstos commented Apr 7, 2017

@juliocanares You are different a problem. You are trying to install a different package than the other people here and are having a problem finding a different module. This ticket was about stringstream. You are having trouble finding a module internal to exceljs. If you think that's a bug in yarn, you should open a new issue.

@juliocanares
Copy link

thanks @markstos I will open a new issue 👍

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