Closed leegee closed 5 years ago
Hello @leegee! I haven't encountered such an issue before, so no idea from top of my head. Could you post little bit more context of how are you trying to use refresh-fetch
?
Thanks
import {configureRefreshFetch, fetchJSON} from 'refresh-fetch';
The requested module '../../refresh-fetch/lib/index.js' does not provide an export named 'fetchJSON'
Trying to get around that:
import * as refreshFetch from 'refresh-fetch';
const {configureRefreshFetch, fetchJSON} = refreshFetch;
exports is not defined
This is the refresh-fetch
downloaded just now, Node 8.15.0 --- running via Mocha via web-component-tester, through latest Chrome on latest OSX.
Also....
[src 13:31:40] git clone https://github.com/vlki/refresh-fetch.git
Cloning into 'refresh-fetch'...
remote: Enumerating objects: 191, done.
remote: Total 191 (delta 0), reused 0 (delta 0), pack-reused 191
Receiving objects: 100% (191/191), 76.56 KiB | 423.00 KiB/s, done.
Resolving deltas: 100% (97/97), done.
[src 13:31:45] cd refresh-fetch/
[refresh-fetch 13:31:47] npm i
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
> fsevents@1.2.7 install /Users/lee.goddard/src/refresh-fetch/node_modules/fsevents
> node install
node-pre-gyp WARN Using request for node-pre-gyp https download
[fsevents] Success: "/Users/lee.goddard/src/refresh-fetch/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" is installed via remote
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
> refresh-fetch@0.5.1 prepublish /Users/lee.goddard/src/refresh-fetch
> npm run clean && npm run lint && npm test && npm run build
> refresh-fetch@0.5.1 clean /Users/lee.goddard/src/refresh-fetch
> rimraf lib dist coverage
> refresh-fetch@0.5.1 lint /Users/lee.goddard/src/refresh-fetch
> eslint src test
Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
at isForInRef (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/rules/no-unused-vars.js:406:24)
at variable.references.some.ref (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/rules/no-unused-vars.js:443:21)
at Array.some (<anonymous>)
at isUsedVariable (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/rules/no-unused-vars.js:442:40)
at collectUnusedVariables (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/rules/no-unused-vars.js:565:26)
at collectUnusedVariables (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/rules/no-unused-vars.js:572:17)
at Program:exit (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/rules/no-unused-vars.js:617:36)
at listeners.(anonymous function).forEach.listener (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/util/safe-emitter.js:47:58)
at Array.forEach (<anonymous>)
at Object.emit (/Users/lee.goddard/src/refresh-fetch/node_modules/eslint/lib/util/safe-emitter.js:47:38)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! refresh-fetch@0.5.1 lint: `eslint src test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the refresh-fetch@0.5.1 lint 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! /Users/lee.goddard/.npm/_logs/2019-01-22T12_32_13_556Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! refresh-fetch@0.5.1 prepublish: `npm run clean && npm run lint && npm test && npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the refresh-fetch@0.5.1 prepublish 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! /Users/lee.goddard/.npm/_logs/2019-01-22T12_32_13_664Z-debug.log
[refresh-fetch 13:32:13]
Regarding the latter, npm install
fails, because I used yarn
for this project and the lock file is therefore for yarn only right now.
Thanks for the info regarding the original issue. I will try refresh-fetch
in web-components-tester
later today to see what might be the problem
Thanks — I think it's just that WCT is trying to run transpiled CommonJS. Why it's trying to do that is another matter!
Hey @leegee, I spent some time with the issue today, but cannot reproduce it. I am able to use refresh-fetch
both in Node.js v8 or Chrome without problems.
But from the error message exports is not defined
it sounds like your environment is not expecting a CommonJS module. Why is that?
So at least I updated dependencies and rebuilt the code using the new Babel v7. Published as v0.6.0
.
I'll open another ticket if I can reproduce the error, thanks for looking into it and updating Babel.
I'm being told
The requested module '../../refresh-fetch/lib/index.js' does not provide an export named 'fetchJSON'
byrefresh-fetch
version 0.5.1 when Node 6.9.2 is calling:Any ideas?