TypeError: node.getIterator is not a function when using VuePress - vuepress

I'm following https://v1.vuepress.vuejs.org/guide/getting-started.html#quick-start to generate a new VuePress site.
I did the following (I'm using Node 15.4.0):
npx create-vuepress-site
cd docs
npm install
npm run build
I'm getting:
TypeError: node.getIterator is not a function
at LazyResult.visitTick (/home/marcin/tmp/vuepress-testing/docs/node_modules/optimize-css-assets-webpack-plugin/node_modules/postcss/lib/lazy-result.js:528:33)
at LazyResult.runAsync (/home/marcin/tmp/vuepress-testing/docs/node_modules/optimize-css-assets-webpack-plugin/node_modules/postcss/lib/lazy-result.js:408:30)
at LazyResult.async (/home/marcin/tmp/vuepress-testing/docs/node_modules/optimize-css-assets-webpack-plugin/node_modules/postcss/lib/lazy-result.js:221:30)
at LazyResult.then (/home/marcin/tmp/vuepress-testing/docs/node_modules/optimize-css-assets-webpack-plugin/node_modules/postcss/lib/lazy-result.js:206:17)
at OptimizeCssAssetsWebpackPlugin.processCss (/home/marcin/tmp/vuepress-testing/docs/node_modules/optimize-css-assets-webpack-plugin/src/index.js:81:8)
at Object.processor (/home/marcin/tmp/vuepress-testing/docs/node_modules/optimize-css-assets-webpack-plugin/src/index.js:20:18)
at /home/marcin/tmp/vuepress-testing/docs/node_modules/last-call-webpack-plugin/src/index.js:150:10
at arrayEach (/home/marcin/tmp/vuepress-testing/docs/node_modules/lodash/_arrayEach.js:15:9)
at forEach (/home/marcin/tmp/vuepress-testing/docs/node_modules/lodash/forEach.js:38:10)
at OptimizeCssAssetsWebpackPlugin.process (/home/marcin/tmp/vuepress-testing/docs/node_modules/last-call-webpack-plugin/src/index.js:147:5)
at /home/marcin/tmp/vuepress-testing/docs/node_modules/last-call-webpack-plugin/src/index.js:178:28
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/marcin/tmp/vuepress-testing/docs/node_modules/tapable/lib/HookCodeFactory.js:33:10), :25:17)
at AsyncSeriesHook.lazyCompileHook (/home/marcin/tmp/vuepress-testing/docs/node_modules/tapable/lib/Hook.js:154:20)
at /home/marcin/tmp/vuepress-testing/docs/node_modules/webpack/lib/Compilation.js:1409:36
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/marcin/tmp/vuepress-testing/docs/node_modules/tapable/lib/HookCodeFactory.js:33:10), :9:1)
at AsyncSeriesHook.lazyCompileHook (/home/marcin/tmp/vuepress-testing/docs/node_modules/tapable/lib/Hook.js:154:20)
I also noticed that the same error started to appear on my existing VuePress site, which worked without issues before (I think even yesterday).
What is the problem? Am I able to get around it somehow?

Same here.
I locked vuepress to version 1.8.1, and build seems fine... until bug fix.

Related

parcel build error: plugin is not a function

I am trying to build a simple web project
project structure like this
-src
--index.html
--index.js
--style.css
package.json
yarn.lock
I installed parcel-bundler with this
yarn global add parcel-bundler
And I run the parcel build command
parcel build src/index.html
But error has occurred followed by this log
D:\playground\js\sample>parcel build src/index.html
× D:\playground\js\sample\src\style.css:undefined:undefined: plugin is not a function
at LazyResult.run (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:288:14)
at LazyResult.asyncTick (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:212:26)
at C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:254:14
at new Promise (<anonymous>)
at LazyResult.async (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:250:23)
at LazyResult.then (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:131:17)
I'm just following the instruction of parcel's official docs
I cannot find a solution
please help me
Try --no-minify
Why is the accepted answer, "throw out the baby with the bathwater?"
parcel-bundler does still work, but instead of fixing what's broken, it's been abandoned for Parcel 2, which DOES NOT support Vue 2 SFCs.
Building a Rails 6/Vue 2 app and converting to parcel from webpack(er), so Parcel 2 is not an option for me. (Demanding people upgrade, and then not providing an upgrade path or decent docs, reminds me too much of webpack!)
parcel build ./app/packs/entrypoints/*.js --no-minify
This disables minification, which at least eliminates this particular error for me.
Problem solved: parcel-bundler is deprecated. Use 'parcel' not 'parcel-bundler'
package.json
If you have preset the scripts...
"scripts": {
"start": "parcel index.html",
"dev": "parcel index.html",
"build": "parcel build index.html"
},
...simply run
npm run build
otherwise use this syntax:
npm run build index.html
Replace index.html to whatever file you want to build, but make sure it is the same type of file.

Signed electron app does not start with robotjs on OSX (Unhandled Errpr: no suitable image found)

I have a signed and notarized App where I want to use robotjs to simulate key taps. I had no problems building robotjs locally but when I run it through the CI, where I sign and notarize the app, the app throws the following error upon starting:
electron/js2c/asar.js:140 Uncaught Error: dlopen(/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr, 1): no suitable image found. Did find:
/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr: code signature in (/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/var/folders/jh/c4kr0qwj0jz2g6qr9y62v3f80000gn/T/.com.electron.w3champions-launcher.JGzZcr: stat() failed with errno=17
at process.func [as dlopen] (electron/js2c/asar.js:140)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1034)
at Object.func [as .node] (electron/js2c/asar.js:149)
at Module.load (internal/modules/cjs/loader.js:815)
at Module._load (internal/modules/cjs/loader.js:727)
at Function.Module._load (electron/js2c/asar.js:769)
at Module.require (internal/modules/cjs/loader.js:852)
at require (internal/modules/cjs/helpers.js:74)
at Object.<anonymous> (/Applications/w3champions-launcher.app/Contents/Resources/app.asar/node_modules/robotjs/index.js:1)
at Object.<anonymous> (/Applications/w3champions-launcher.app/Contents/Resources/app.asar/node_modules/robotjs/index.js:38)
I have the feeling that I do not sign the built robotjs stuff and therefore OSX is not happy when loading it. If I remove the notarize step, I get the same error. Those are my build commands:
"build": "npm run rebuild && vue-cli-service electron:build",
"rebuild": "npm rebuild --runtime=electron --target=9.1.2 --disturl=https://atom.io/download/atom-shell --abi=80",
I found something here: https://github.com/electron-userland/electron-builder/issues/4040#issuecomment-543252275 but I lack electron knowledge to make this happen. Also he uses react and a 2 package.json solution, which I do not have. Do I have to add a sign step for robotjs and if so, how do I do that? On Windows everything is working fine, no problem in signing and building.
this would be the repo:
https://github.com/w3champions/w3champions-launcher
Ok, i somehow stumbled over a post where something similar happened and fixed it. What I changed in my odyssey of google are the following things, maybe one of those might help someone:
In the vue.config.js I added
builderOptions.mac.entitlementsInherit = "build/entitlements.mac.inherit.plist". Earlier I only had builderOptions.mac.entitlements
I added those tow entitelments to my entitelments list:
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
In the package.json i changed my build sightly to
"build": "npm run rebuild && vue-cli-service electron:build",
"rebuild": "npm rebuild --runtime=electron --target=9.1.2 -- disturl=https://atom.io/download/atom-shell --abi=80"
The change was mearly to make the abi the correct one. You can get the needed abi by electron --abi

`Cannot use e "__Schema" from another module or realm.` and `Duplicate "graphql" modules` using ApolloClient

I have a React application with ApolloClient with Apollo-Link-Schema. The application works fine locally but in our staging environment (using GOCD), we get the following error:
Uncaught Error: Cannot use e "__Schema" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
at t.a (instanceOf.mjs:21)
at C (definition.mjs:37)
at _ (definition.mjs:22)
at X (definition.mjs:284)
at J (definition.mjs:287)
at new Y (definition.mjs:252)
at Y (definition.mjs:254)
at Object.<anonymous> (introspection.mjs:459)
at u (NominationsApprovals.module.js:80)
at Object.<anonymous> (validate.mjs:1)
Dependencies are installed with yarn, I've added the resolutions field to the package.json.
"resolutions": {
"graphql": "^14.5.8"
},
I've checked the yarn.lock and can only find one reference for the graphql package.
npm ls graphql does not display any duplicates.
I thought maybe its a build issue with webpack - I have a different build script for staging, but running that locally I am still able to get the react application to run with that bundle.
Can anyone suggest anything else to help me fix this?
I managed to find the cause of the issue, if this helps anyone else. The issue is not to do with duplicate instances of the package at all, this is a false positive triggered by us using webpack's DefinePlugin to set the process.env.NODE_ENV to staging for our staging build.
However, in webpack the mode (see https://webpack.js.org/configuration/mode/), which sets the process.env.NODE_ENV, only accepts none, development and production as valid values. This was triggering an env check in the graphql package to fail and trigger this error message.
In our case, we need to differentiate between staging and production as our API endpoint differs based on this, but the solution we implemented is to not rely on the process.env.NODE_ENV, but to assign a custom variable on build (e.g. process.env.API_URL)
I would try to replicate the error locally and debug it:
try this:
rm -rf node_modules yarn.lock
# also remove any lock files if you have package-lock.json too
yarn install
# build the project locally and see if you got the error
I got this problem one time where I was working with Gatsby and 2 different themes where using different versions of GraphQL. Also be more explicit with the version (without caret) and check if the error persist.
do you have a repo youc an share? that would also help us to help you :)
While changing NODE_ENV to production might solve the issue, if you have different variables for each environment and don't want to mess with your metrics this is not an ideal solution.
You said you use webpack. If the build with the issue uses some kind of source-map in your devtool, you might want to disable that to see if the problem persists. That's how I solved this without setting my NODE_ENV to production.
I had a similar problem when trying to run Apollo codegen and was able to fix it by deduping my npm packages. Run this:
rm -rf node_modules && npm i && npm dedupe
I was having this problem so I switched to yarn, and after deleting node_modules and npm lockfile, then running yarn, the problem went away :-).
I ended up here because I use the AWS CDK and the NodejsFunction Construct. I was also using bundling with minify: true.
Toggling minify to false resolved this for me.

How to successfully run elm-coverage?

I try to configure elm-coverage to be used in CI.
Installation was successful, installed using yarn as "elm-coverage": "0.2.0"
Our most recent command for running tests is
./node_modules/.bin/elm-test --compiler ./node_modules/.bin/elm app/frontend/elm/tests/
app/frontend/ is there, because elm app is within repository of rails app.
When I try to use coverage
elm-coverage --elm-test ./node_modules/.bin/elm-test -- --compiler ./node_modules/.bin/elm app/frontend/elm/tests/
in (ruby app's) root, it returns
MacBook-Pro-6:enectiva admin$ elm-coverage --elm-test ./node_modules/.bin/elm-test -- --compiler ./node_modules/.bin/elm app/frontend/elm/tests/
/Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:33
throw err;
^
Error: does not exist.
at Object.notExist (/Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:41:12)
at traverseAsync (/Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:163:28)
at /Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:282:7
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Otherwise, I tried
MacBook-Pro-6:enectiva admin$ elm-coverage app/frontend/elm/tests/ --elm-test ./node_modules/.bin/elm-test
[12:57:01.68] Instrumenting sources...
[12:57:01.89] Something went wrong:
I searched through issues in Github repository, it does not seem to be reported bug, so there must be something I missed.
Does anyone know, how to actually use it?
OK, I've had a bit more of a play with elm-coverage, as I've been able to get it to run on an Elm project of mine.
Firstly elm-coverage has a --verbose flag which adds extra logging, so try running with that.
I've had best results if I cd to the folder containing my elm.json file and run elm-coverage from there. In your case, this would look something like the following:
cd app/frontend/elm && elm-coverage [source folder] --elm-test ../../../node_modules/.bin/elm-test
[source folder] is the name of the folder containing your source files (not the tests). For me, [source folder] is src, but because that's the default I can omit it.

gulp watch in laravel elixir not working globule.js undefined indexof

I have a Laravel project in Ubuntu 16.04.
It is an existing project where the gulpfile.js is working properly on another system.
My problem is the gulp watch is not working at only this error is showing up:
TypeError: Cannot read property 'indexOf' of undefined
at /usr/lib/node_modules/gulp/node_modules/globule/lib/globule.js:25:16
at Array.reduce (native)
at processPatterns (/usr/lib/node_modules/gulp/node_modules/globule/lib/globule.js:24:30)
at Object.globule.find (/usr/lib/node_modules/gulp/node_modules/globule/lib/globule.js:76:17)
at Gaze.add (/usr/lib/node_modules/gulp/node_modules/gaze/lib/gaze.js:174:19)
at new Gaze (/usr/lib/node_modules/gulp/node_modules/gaze/lib/gaze.js:74:10)
at gaze (/usr/lib/node_modules/gulp/node_modules/gaze/lib/gaze.js:86:10)
at Object.module.exports [as watch] (/usr/lib/node_modules/gulp/node_modules/glob-watcher/index.js:12:17)
at Gulp.watch (/usr/lib/node_modules/gulp/index.js:40:14)
at /home/vagrant/votingmp/node_modules/laravel-elixir/dist/tasks/recipes/watch.js:26:18
Has anybody ever had the same problem? I can't seem to find any solution regarding this
Cannot read property 'indexOf' of undefined
at /usr/lib/node_modules/gulp/node_modules/globule/lib/globule.js:25:16
Any helps appreciated!
I have same problem with you, then I realize that one of my script files gen errors, so just remove it from mix.scripts([]) array, unless please check your gulp.js content.

Resources