node:internal/errors:464
ErrorCaptureStackTrace(err);
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [
'/c',
'start',
'""',
'/b',
'/wait',
'http://127.0.0.1:8000?position=0%2C0^&SCENE_DEBUG_PANEL'
]
}
Related
I'm using gulp 4. I'd like to do the following:
clean my src and dist folders
copy bootstrap over to src folder from node_modules
Then run sass on bootstrap
However when I try to use series() command, my CSS tasks fails. It's like my CSS task is trying to run on a file that doesn't exist. I thought series runs only if the task before each is completed. I know my move task runs successfully if i run it without series.
const {src, dest, series, parallel} = require('gulp');
const del = require('del');
const sass = require('gulp-sass')(require('sass'));
sass.compiler = require('sass');
async function clean(cb){
console.log("starting clean");
await del(["src", "build"]);
console.log("done cleaning");
cb();
}
function copy(cb){
console.log("starting copying...");
src("./node_modules/bootstrap/js/**/*").pipe(dest("./src/js/bootstrap"));
src("./node_modules/bootstrap/scss/**/*").pipe(dest("./src/scss/bootstrap"));
console.log("finished copying...");
cb();
}
function css(cb){
console.log("starting sass....");
src('./src/scss/bootstrap/bootstrap.scss')
.pipe(sass().on('error', sass.logError))
.pipe(dest('./build/css'));
console.log("sass complete");
cb();
};
function log(cb){
console.log("Logging....");
cb();
}
exports.css = css;
exports.clean = clean;
exports.copy = copy;
exports.default = series(clean, log, copy, css);
Error
Error: File not found with singular glob: /Users/x/Sites/bootstrap5/src/scss/bootstrap/bootstrap.scss (if this was purposeful, use `allowEmpty` option)
at Glob.<anonymous> (/Users/x/Sites/bootstrap5/node_modules/glob-stream/readable.js:84:17)
at Object.onceWrapper (events.js:286:20)
at Glob.emit (events.js:198:13)
at Glob.EventEmitter.emit (domain.js:448:20)
at Glob._finish (/Users/x/Sites/bootstrap5/node_modules/glob/glob.js:194:8)
at done (/Users/x/Sites/bootstrap5/node_modules/glob/glob.js:179:14)
at Glob._processSimple2 (/Users/x/Sites/bootstrap5/node_modules/glob/glob.js:688:12)
at /Users/x/Sites/bootstrap5/node_modules/glob/glob.js:676:10
at Glob._stat2 (/Users/x/Sites/bootstrap5/node_modules/glob/glob.js:772:12)
at lstatcb_ (/Users/x/Sites/bootstrap5/node_modules/glob/glob.js:764:12)
Emitted 'error' event at:
at DestroyableTransform.EventEmitter.emit (domain.js:461:12)
at Pumpify.emit (events.js:198:13)
at Pumpify.EventEmitter.emit (domain.js:448:20)
at Pumpify.Duplexify._destroy (/Users/x/Sites/bootstrap5/node_modules/duplexify/index.js:191:15)
at /Users/x/Sites/bootstrap5/node_modules/duplexify/index.js:182:10
at process._tickCallback (internal/process/next_tick.js:61:11)
my package:
{
"name": "bootstrap5",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^5.2.1"
},
"devDependencies": {
"del": "^4.1.1",
"gulp": "^4.0.2",
"gulp-sass": "^5.1.0",
"gulp-sourcemaps": "^3.0.0",
"rimraf": "^3.0.2",
"sass": "^1.54.9"
}
}
You have a typo on the 4th line of gulpfile: const sass = require('gulp-sass')(require('sass'));
Maybe this causes the problem
in my createChat mutation, 'CHAT_EXISTS' error appear on the graphiql interface but 'USER_NOT_EXISTS' error is being received in the terminal and app is getting crashed when this error is thrown in the terminal. Where am i doin' wrong?🤔🤔
createChat: async (
_: any,
{ people, message }: { people: string[]; message: Message },
{ users, chats, messages }: any
) => {
const chatExist = await chats.findOne({ people });
if (chatExist)
throw new GraphQLYogaError('Chat exists', { code: 'CHAT_EXISTS' });
people.forEach(async (user) => {
const userExist = await users.findOne(
{ _id: user },
{
about: 0,
state: 0,
country: 0,
activeChats: 0,
email: 0,
lastActive: 0,
name: 0,
publicKey: 0,
profilePic: 0,
}
);
if (userExist === null) {
throw new GraphQLYogaError(`User doesn't exist`, {
code: 'USER_NOT_EXISTS',
});
}
});
const messagesId = await genId(messages);
const newMessage = {
_id: messagesId,
messages: [message],
};
await messages.insertOne(newMessage);
const chatId = await genId(chats);
const newChat = {
_id: chatId,
messages: messagesId,
lastMessage: message,
people,
};
await chats.insertOne(newChat);
people.forEach(async (user) => {
await users.updateOne({ _id: user }, { $push: { activeChats: chatId } });
pubsub.publish('newChat', user, newChat);
});
return chatId;
}
i'm getting this error in the terminal
D:\react-apps\connect-chat-app\node_modules\#envelop\core\index.js:1150
[1] super(message, undefined, undefined, undefined, undefined, undefined, extensions);
[1] ^
[1]
[1] EnvelopError [GraphQLError]: User doesn't exist
[1] at new EnvelopError (D:\react-apps\connect-chat-app\node_modules\#envelop\core\index.js:1150:9)
[1] at D:\react-apps\connect-chat-app\dist\main.js:261:35
[1] at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[1] path: undefined,
[1] locations: undefined,
[1] extensions: { code: 'USER_NOT_EXISTS' }
[1] }
[1] [nodemon] app crashed - waiting for file changes before starting...
and getting this in the graphiql -
{
"errors": {
"message": "Failed to fetch",
"stack": "TypeError: Failed to fetch\n at defaultAsyncFetch (https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:44822:10)\n at https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:45179:22\n at new ValueOrPromise (https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:39010:15)\n at executor (https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:45153:14)\n at https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:45385:74\n at https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:39032:106\n at new ValueOrPromise (https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:39010:15)\n at ValueOrPromise.then (https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:39032:81)\n at https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:45385:55\n at fetcher2 (https://unpkg.com/#graphql-yoga/graphiql#2.3.0/dist/yoga-graphiql.es.js:48367:14)"
}
}
packages i'm using -
"dependencies": {
"#envelop/disable-introspection": "^3.3.1",
"#graphql-yoga/node": "^2.3.0",
"#types/graphql-upload": "^8.0.11",
"crypto-js": "^4.1.1",
"dotenv": "^16.0.0",
"graphql": "^16.3.0",
"graphql-type-json": "^0.3.2",
"graphql-upload": "^13.0.0",
"mongodb": "^4.5.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"#types/crypto-js": "^4.1.1",
"#types/node": "^17.0.26",
"#types/uuid": "^8.3.4",
"concurrently": "^7.1.0",
"nodemon": "^2.0.15",
"parcel": "^2.5.0"
}
Recently, we created a new upload image/PDF function.
When someone uploaded a PDF, the server still worked. But after a daily restart, the server kept crashing:
2022-05-25T00:52:13.648659+00:00 app[web.1]: (node:3) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
2022-05-25T00:52:13.747819+00:00 app[web.1]: internal/streams/legacy.js:61
2022-05-25T00:52:13.747821+00:00 app[web.1]: throw er; // Unhandled stream error in pipe.
2022-05-25T00:52:13.747821+00:00 app[web.1]: ^
2022-05-25T00:52:13.747821+00:00 app[web.1]:
2022-05-25T00:52:13.747822+00:00 app[web.1]: [Error: ENOENT: no such file or directory, open '/app/.meteor/heroku_build/cfs/files/_tempstore/retailerRegistrationMedia-w6e6Kxgy8QLTgirET-0.chunk'] {
2022-05-25T00:52:13.747822+00:00 app[web.1]: errno: -2,
2022-05-25T00:52:13.747823+00:00 app[web.1]: code: 'ENOENT',
2022-05-25T00:52:13.747823+00:00 app[web.1]: syscall: 'open',
2022-05-25T00:52:13.747835+00:00 app[web.1]: path: '/app/.meteor/heroku_build/cfs/files/_tempstore/retailerRegistrationMedia-w6e6Kxgy8QLTgirET-0.chunk'
2022-05-25T00:52:13.747836+00:00 app[web.1]: }
Investigating further, it appears that if we delete last record from the cfs._tempstore.chunks collection, the server can then starts correctly.
Also, the crash ONLY happens, if the uploaded media is a PDF. No crash if uploaded media is image
What is the cause of this error?
Relevant code to save an image below:
Meteor.utilities.addRetailerRegistrationMediaFile(e, function(fileId){
if(e.target.id == "companyACRAFile"){
tpl.companyACRAFile = fileId;
}else if(e.target.id == "companyShopPhotos"){
tpl.companyShopPhotos.push(fileId);
console.log("tpl.companyShopPhotos", tpl.companyShopPhotos);
}
});
Meteor.utilities.addRetailerRegistrationMediaFile = function (e, callback) {
var $target = $(e.currentTarget)
FS.Utility.eachFile(e, function (file) {
RetailerRegistrationMediaObjects.insert(file, function (err, fileObj) {
if (err) {
return throwError(err);
}else{
callback(fileObj._id);
}
});
});
};
// For all retailer application media
RetailerRegistrationMediaObjects = new FS.Collection("retailerRegistrationMedia", {
stores: [
new FS.Store.S3("registrationThumbs", {
region: settings.public.aws_region,
accessKeyId: settings.public.aws_key_id,
secretAccessKey: settings.public.aws_access_key,
bucket: settings.public.aws_bucket,
folder: "registration/thumbs",
transformWrite: createThumbIfImage,
}),
new FS.Store.S3("registration", {
region: settings.public.aws_region,
accessKeyId: settings.public.aws_key_id,
secretAccessKey: settings.public.aws_access_key,
bucket: settings.public.aws_bucket,
folder: "registration",
}),
],
filter: {
maxSize: 5000000, //in bytes
allow: {
contentTypes: ["image/*", "application/pdf"],
},
onInvalid: function (message) {
if (Meteor.isClient) {
// prepare the data for notification
sAlert.error(message);
}
},
},
});
RetailerRegistrationMediaObjects.allow({
insert: function (userId, doc) {
return true;
},
update: function (userId, doc, fieldNames, modifier) {
return true
},
remove: function (userId, doc) {
return true
},
download: function (userId) {
return true;
},
});
I keep getting an error when running a basic sample with Nightwatch.js + Testing Library:
[Ecosia Search With TL] Test Suite
==================================
ℹ Connected to localhost on port 9515 (1077ms).
Using: chrome (87.0.4280.66) on Mac OS X platform.
Running: Demo test ecosia.org
matcher.test is not a function
FAILED: 1 errors (935ms)
_________________________________________________
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (2.779s)
✖ ecosiaSearchWithTL
– Demo test ecosia.org (935ms)
Error: [object Object]
at processTicksAndRejections (internal/process/task_queues.js:97:5)
npm ERR! Test failed. See above for more details.
This is my only test:
const { getQueriesFrom } = require('#testing-library/nightwatch')
module.exports = {
async beforeEach(browser) {
await browser.url('https://www.ecosia.org/')
},
async 'Demo test ecosia.org'(browser) {
const { getByRole } = getQueriesFrom(browser)
const searchBox = await getByRole('searchbox', { name: /search form/i })
browser.setValue(searchBox, 'nightwatch')
const submit = await getByRole('button', { name: /submit/i })
browser.click(submit)
browser.end()
}
}
My nightwatch.conf.js:
module.exports = {
src_folders: ['tests'],
webdriver: {
start_process: true,
port: 9515,
server_path: "node_modules/.bin/chromedriver",
},
test_settings: {
default: {
desiredCapabilities : {
browserName: "chrome"
}
}
}
};
Any idea why I keep getting that error?
It works flawlessly without Testing Library.
I've been trying to get SCSS global variables to work using webpack, but it doesn't seem to resolve the paths correctly in any attempt I make.
The config looks as following (using electron-webpack, extending the default config)
const path = require('path');
const merge = require('webpack-merge');
const webpackRenderer = require('electron-webpack/webpack.renderer.config.js');
const cssnano = require('cssnano');
const { extend, find, flow, has } = require('lodash');
const isProd = process.env.NODE_ENV === 'production';
function replaceLoader(config, test, callback) {
const rule = find(config.module.rules, (r) => String(r.test) === String(test));
if (rule) {
extend(rule, callback(rule));
}
return config;
}
// Since we want to uses SCSS modules, we need to replace the
// default SCSS loader config that ships with electron-webpack.
function replaceSassLoader(config) {
const minimize = isProd
? [
{
loader: 'postcss-loader',
options: {
plugins: [cssnano({ preset: 'default' })]
}
}
]
: [];
return replaceLoader(config, /\.scss$/, () => ({
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: {
localIdentName: '[name]__[local]___[hash:base64:5]'
},
sourceMap: !isProd,
importLoaders: 1
}
},
...minimize,
{
loader: 'sass-loader',
options: {
data:
'#import "~common/stylesheets/variables"; #import "~common/stylesheets/mixins"; #import "~common/stylesheets/themes";',
includePaths: [path.resolve(__dirname, '..', 'src/common')],
sourceMap: !isProd
}
}
]
}));
}
module.exports = async (env) => {
const config = await webpackRenderer(env);
const newConfig = merge.smart(config, {
resolve: {
alias: {
common: path.resolve(__dirname, '..', 'src/common'),
}
}
});
return flow(replaceSassLoader)(newConfig);
};
Used versions:
"electron-webpack": "2.7.4",
"node-sass": "4.13.0",
"sass-loader": "8.0.0",
"webpack": "4.41.2",
"webpack-cli": "3.3.10",
"webpack-dev-server": "3.9.0",
"webpack-merge": "4.2.2"
Whatever attempt/tweaks I do to the path resolving/config I continue to receive the same errors like these:
[start:renderer] # multi css-hot-loader/hotModuleReplacement ./src/renderer/index.js
[start:renderer] Child html-webpack-plugin for "index.html":
[start:renderer] 1 asset
[start:renderer] Entrypoint undefined = index.html
[start:renderer] [./node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html] 360 bytes {0} [built]
[start:renderer] Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-2!node_modules/rc-tooltip/assets/bootstrap.css:
[start:renderer] Entrypoint mini-css-extract-plugin = *
[start:renderer] [./node_modules/css-loader/dist/cjs.js?!./node_modules/rc-tooltip/assets/bootstrap.css] ./node_modules/css-loader/dist/cjs.js??ref--6-2!./node_modules/rc-tooltip/assets/bootstrap.css 4.22 KiB {mini-css-extract-plugin} [built]
[start:renderer] [./node_modules/css-loader/dist/runtime/api.js] 2.61 KiB {mini-css-extract-plugin} [built]
[start:renderer] Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--8-2!node_modules/sass-loader/dist/cjs.js!src/renderer/account/components/Account/Account.scss:
[start:renderer] Entrypoint mini-css-extract-plugin = *
[start:renderer] [./node_modules/css-loader/dist/cjs.js?!./node_modules/sass-loader/dist/cjs.js!./src/renderer/account/components/Account/Account.scss] ./node_modules/css-loader/dist/cjs.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js!./src/renderer/account/components/Account/Account.scss 368 bytes {mini-css-extract-plugin} [built] [failed] [1 error]
[start:renderer]
[start:renderer] ERROR in ./src/renderer/account/components/Account/Account.scss (./node_modules/css-loader/dist/cjs.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js!./src/renderer/account/components/Account/Account.scss)
[start:renderer] Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
[start:renderer] SassError: Undefined variable: "$responsive-width".
[start:renderer] on line 18 of /<path_to_project>/src/renderer/account/components/Account/Account.scss
[start:renderer] >> #media only screen and (max-width: $responsive-width) {
[start:renderer]
[start:renderer] ---------------------------------------^
[start:renderer] Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--8-2!node_modules/sass-loader/dist/cjs.js!src/renderer/shared/components/Panel/Panel.scss:
[start:renderer] Entrypoint mini-css-extract-plugin = *
[start:renderer] [./node_modules/css-loader/dist/cjs.js?!./node_modules/sass-loader/dist/cjs.js!./src/renderer/shared/components/Panel/Panel.scss] ./node_modules/css-loader/dist/cjs.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js!./src/renderer/shared/components/Panel/Panel.scss 432 bytes {mini-css-extract-plugin} [built] [failed] [1 error]
[start:renderer]
[start:renderer] ERROR in ./src/renderer/shared/components/Panel/Panel.scss (./node_modules/css-loader/dist/cjs.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js!./src/renderer/shared/components/Panel/Panel.scss)
[start:renderer] Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
[start:renderer] SassError: ".panel" failed to #extend "%panelColor".
[start:renderer] The selector "%panelColor" was not found.
[start:renderer] Use "#extend %panelColor !optional" if the extend should be able to fail.
[start:renderer] on line 2 of D:\Development\<path>\src\renderer\shared\components\Panel\Panel.scss
[start:renderer] >> #extend %panelColor;
[start:renderer] ----------^
It all used to be working with webpack 2/babel 6.
We used module resolving from babel 6, which was removed in babel 7, so I replaced it with the webpack 4 resolution aliases and that was the point where all the above issues arised when upgrading all the webpack/babel related packages