I have used mongoose package in my nest project but when I am trying to build the project using npm run build.Then its throwing below error in my console:
node_modules/mongoose/node_modules/mongodb/mongodb.d.ts:34:15 - error TS2305: Module '"tls"'
has no exported member 'TLSSocketOptions'.
34 import type { TLSSocketOptions } from 'tls';
I have even updated the mongoose package to the latest version.Then also I am getting the same error:
Below are my dependencies inside package.json file:
"dependencies": {
"#apollo/gateway": "^0.38.0",
"#google-cloud/translate": "^6.2.1",
"#nestjs/common": "^8.0.6",
"#nestjs/core": "^8.0.6",
"#nestjs/cqrs": "^8.0.0",
"#nestjs/graphql": "^8.0.2",
"#nestjs/microservices": "^8.0.6",
"#nestjs/mongoose": "^9.0.3",
"#nestjs/platform-express": "^8.0.6",
"#types/luxon": "^1.15.1",
"apollo-server-express": "^2.25.2",
"bunyan": "^1.8.12",
"bunyan-rotating-file-stream": "^1.6.3",
"connect-redis": "^3.4.1",
"consul": "^0.40.0",
"device-detector-js": "^3.0.3",
"elasticsearch": "^16.2.0",
"express-session": "^1.16.2",
"firebase-admin": "^9.4.2",
"graphql": "^14.7.0",
"graphql-tools": "^4.0.4",
"json-rules-engine": "^3.1.0",
"kafkajs": "^1.15.0",
"lodash": "^4.17.21",
"luxon": "^1.16.0",
"moneysafe": "^2.2.1",
"mongodb": "^3.5.9",
"mongoose": "^6.3.0",
"nestjs-i18n": "^8.1.1",
"node-wit": "^6.0.0",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"rxjs": "^7.3.0",
"ts-morph": "^12.0.0",
"typescript": "^4.3.5",
"uuid": "^3.3.2"
},
"devDependencies": {
"#nestjs/testing": "^5.1.0",
"#types/jest": "^23.3.1",
"#types/lodash": "^4.14.134",
"#types/node": "^10.7.1",
"#types/supertest": "^2.0.5",
"jest": "^23.5.0",
"nodemon": "^1.18.3",
"prettier": "^1.14.2",
"supertest": "^3.1.0",
"ts-jest": "^23.1.3",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.1",
"tsconfig-paths": "^3.5.0",
"tslint": "5.11.0"
}
Someone let me know how can I resolve this error.Any help on this will be really appreciated.
I fixed this by updating #types/node to the latest version. This specific error message is then fixed!
Related
I'm using visual studio code with node v18.
I use structuredClone in my application and it runs fine but when it comes to running a test I get
"ReferenceError: structuredClone is not defined"
I don't know how mocha works, but is it for some reason using an older version of node or is there some other dependency creating an issue?
"dependencies": {
"#sendgrid/mail": "^7.6.2",
"#types/chai": "^4.3.1",
"#types/express": "^4.17.13",
"#types/mocha": "^9.1.1",
"#types/node": "^18.0.0",
"#types/npm": "^7.19.0",
"bcrypt": "^5.0.1",
"body-parser": "^1.19.2",
"chai": "^4.3.6",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.6",
"dotenv": "^16.0.0",
"eventemitter2": "^6.4.5",
"express": "^4.17.3",
"express-validator": "^6.14.0",
"jsdom": "^20.0.0",
"jsonwebtoken": "^8.5.1",
"marked": "^4.0.12",
"memory-cache": "^0.2.0",
"mocha": "^10.0.0",
"mssql": "^8.0.2",
"sanitize-html": "^2.7.0",
"validator": "^13.7.0",
"xsg.spider": "file:./../spider"
},
"devDependencies": {
"#types/bcrypt": "^5.0.0",
"#types/connect-flash": "^0.0.37",
"#types/cookie-parser": "^1.4.2",
"#types/dompurify": "^2.3.3",
"#types/jsdom": "^16.2.14",
"#types/jsonwebtoken": "^8.5.8",
"#types/marked": "^4.0.3",
"#types/memory-cache": "^0.2.2",
"#types/mssql": "^7.1.5",
"#types/passport-local": "^1.0.34",
"#types/sanitize-html": "^2.6.2",
"#types/validator": "^13.7.2",
"nyc": "^15.1.0",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
}
It's probably a bug, as a turnaround to deep clone your object, you can use JSON.parse & JSON.stringify:
if (global.structuredClone)
clonedObject = structuredClone(object)
else
clonedObject = JSON.parse(JSON.stringify(object))
I am facing the following error:
'Switch' cannot be used as a JSX component.
Its instance type 'Switch' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'React.ReactNode' is not assignable to type 'import("/usr/src/app/client/node_modules/#types/react-transition-group/node_modules/#types/react/index").ReactNode'.
Type '{}' is not assignable to type 'ReactNode'.
Type '{}' is not assignable to type 'ReactPortal'. TS2786
I have not changed any version. And also not modify the code of my app. 5 days ago this started to not compile in my remote server. I create the images on a alpine:node docker with version 14.17.4
Can someone provide some insight on where is the error here?
Dependencies versions:
"dependencies": {
"#material-ui/core": "^4.11.0",
"#material-ui/icons": "^4.9.1",
"#material-ui/lab": "^4.0.0-alpha.56",
"#material-ui/pickers": "^4.0.0-alpha.12",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"#types/openpgp": "^4.4.14",
"#types/truncate-middle": "^1.0.1",
"axios": "^0.20.0",
"bottleneck": "^2.19.5",
"clsx": "^1.1.1",
"file-saver": "^2.0.5",
"file-selector": "^0.2.2",
"form-data": "^3.0.0",
"formik": "^2.1.4",
"formik-material-ui": "^2.0.0-beta.1",
"formik-material-ui-lab": "0.0.5",
"formik-material-ui-pickers": "0.0.8",
"http-proxy-middleware": "^1.0.6",
"lodash": "^4.17.15",
"material-ui-dropzone": "3.3.0",
"moment": "^2.26.0",
"node-fetch": "^2.6.0",
"node-sass": "^4.14.1",
"openpgp": "^4.4.5",
"promise.allsettled": "^1.0.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-flexbox-grid": "^2.1.2",
"react-ga": "^2.7.0",
"react-joyride": "^2.3.0",
"react-kawaii": "^0.16.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-scrollable-feed": "^1.1.2",
"react-snowfall": "1.0.2",
"react-spring": "^8.0.27",
"trace-error": "^1.0.3",
"truncate-middle": "^1.0.6",
"typescript": "^3.7.5",
"uuid": "^8.1.0",
"yup": "^0.29.1"
},
"devDependencies": {
"#types/file-saver": "^2.0.1",
"#types/jest": "^24.9.1",
"#types/lodash": "^4.14.155",
"#types/node": "^12.12.59",
"#types/react": "^16.9.36",
"#types/react-dom": "^16.9.8",
"#types/react-kawaii": "^0.11.0",
"#types/react-router-dom": "^5.1.5",
"#types/uuid": "^8.0.0",
"#types/yup": "^0.29.3"
}
Could it be that the dependencie React version of react-transition-group is different than the normal one? It doesn't make sense for me that this compiles in local and not in remote.
Actualy I try to intgrat
but I face to this exception my node version is 16.3.2 32bit
C:\Users\PC\Desktop\electron_project_X32\node_modules\express\lib\application.js:630 Error: Loading non-context-aware native module in renderer: '\\?\C:\Users\PC\Desktop\electron_project_X32\node_modules\#chilkat\ck-electron16-win-ia32\chilkat.node'. See https://github.com/electron/electron/issues/18397.
at process.func [as dlopen] (node:electron/js2c/asar_bundle:5)
and this is may package.json
"devDependencies": {
"cpx": "^1.5.0",
"electron": "^16.1.0",
"electron-packager": "^15.4.0",
"electron-rebuild": "^3.2.7",
"ncp": "^2.0.0"
},
"dependencies": {
"#chilkat/ck-electron16-win-ia32": "^9.50.89",
"#chilkat/ck-node16-win-ia32": "^9.50.89",
"cors": "^2.8.5",
"crypto-js": "^4.1.1",
"crypto-md5": "^1.0.0",
"dotenv": "^16.0.0",
"electron-tabs": "^0.15.0",
"express": "^4.17.3",
"ffi-napi": "^4.0.3",
"freemarker": "^2.0.1",
"md5": "^2.3.0",
"multer": "^1.4.4",
"node-cron": "^3.0.0",
"node-key-sender": "^1.0.11",
"node-notifier": "^10.0.1",
"npm": "^8.5.3",
"pkg": "^5.5.2",
"serialport": "^10.4.0",
"sudo-prompt": "^9.2.1",
"through2": "^4.0.2",
"websocket": "^1.0.34"
}
I try to set this app.allowRendererProcessReuse = false in main.js but it don't solve the problem
SOLVED BY #chilkat Software by upgrading the current version of chilkat/ck-electron16-win64 and win32
Error: Cannot find module 'sharp'
Require stack:
- D:\Marketing\sbj-react\suburban\node_modules\gatsby-plugin-manifest\safe-sharp.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby-plugin-manifest\gatsby-node.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\index.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\commands\develop.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby-cli\lib\create-cli.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby-cli\lib\index.js
- D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bin\gatsby.js
1) npm install
2) npm also check with npm install --unsafe perm
3) npm start
4) npm install sharp
But still have same problem with me please resolve my question.
This is my package.json
{
"name": "Ashish",
"description": "Ashish Group Project",
"version": "1.0.0",
"author": "AshishBhangade <ashishbhangade#gmail.com>",
"dependencies": {
"axios": "^0.18.0",
"babel-plugin-styled-components": "^1.10.0",
"base-64": "^0.1.0",
"bcryptjs": "^2.4.3",
"bootstrap": "^4.1.3",
"gatsby": "^2.0.53",
"gatsby-background-image": "^0.9.11",
"gatsby-graphiql-explorer": "^0.2.29",
"gatsby-image": "^2.0.20",
"gatsby-plugin-compression": "0.0.1",
"gatsby-plugin-compression-v2": "^0.1.0",
"gatsby-plugin-drift": "^1.0.0",
"gatsby-plugin-facebook-analytics": "^2.0.2",
"gatsby-plugin-facebook-pixel": "^1.0.3",
"gatsby-plugin-facebook-sdk": "^1.0.6",
"gatsby-plugin-google-analytics": "^2.0.9",
"gatsby-plugin-google-gtag": "^1.0.8",
"gatsby-plugin-google-tagmanager": "^2.0.7",
"gatsby-plugin-hotjar": "^1.0.1",
"gatsby-plugin-manifest": "^2.0.9",
"gatsby-plugin-netlify": "^2.0.6",
"gatsby-plugin-offline": "^2.0.21",
"gatsby-plugin-react-helmet": "^3.0.2",
"gatsby-plugin-robots-txt": "^1.4.0",
"gatsby-plugin-sass": "^2.0.5",
"gatsby-plugin-sentry": "^1.0.0",
"gatsby-plugin-sharp": "^2.0.12",
"gatsby-plugin-sitemap": "^2.0.4",
"gatsby-plugin-styled-components": "^3.0.4",
"gatsby-plugin-zopfli": "^1.0.2",
"gatsby-source-apiserver": "^2.1.4",
"gatsby-source-filesystem": "^2.0.8",
"gatsby-transformer-sharp": "^2.1.8",
"jquery": "^3.3.1",
"logrocket": "^1.0.6",
"logrocket-react": "^4.0.1",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"node-sass": "^4.10.0",
"perm": "^1.0.0",
"react": "^16.6.3",
"react-bootstrap": "^0.32.4",
"react-bootstrap-time-picker": "^1.0.3",
"react-datepicker": "^2.0.0",
"react-device-detect": "^1.11.14",
"react-dom": "^16.6.3",
"react-ga": "^2.5.6",
"react-helmet": "^5.2.0",
"react-input-mask": "^2.0.4",
"react-number-format": "^4.0.6",
"react-otp-input": "^0.3.1",
"react-phone-input-2": "^2.11.0",
"react-places-autocomplete": "^7.2.1",
"react-popper": "^1.3.2",
"react-scroll": "^1.7.12",
"react-select": "^3.0.8",
"react-slick": "^0.23.2",
"reactstrap": "^6.5.0",
"slick-carousel": "^1.8.1",
"socket.io-client": "^2.2.0",
"styled-components": "^4.1.3",
"universal-cookie": "^3.0.7"
}
}
I had the same problem and solved with
npm install sharp
I was getting the same error on a mac and this fixed my issue
Basically:
delete node_modules folder
xcode-select --install
close and open terminal
yarn install (I assume it would also work with npm install)
npm rebuild --verbose sharp
this single line command helped me. This was a magic.
Error Log On initiating application
While initiating the application it shows the following error and i tried couple of fixes from online which has mentioned below but none of them has worked requesting for suggestions and solutions
node_modules/#types/graphql/subscription/subscribe.d.ts(17,12): error TS2304: Cannot find name 'AsyncIterator'.
node_modules/#types/graphql/subscription/subscribe.d.ts(29,12): error TS2304: Cannot find name 'AsyncIterable'.
node_modules/graphql-tools/dist/stitching/makeRemoteExecutableSchema.d.ts(3,109): error TS2304: Cannot find name 'AsyncIterator'.
Fixes Tried as per google results
Adding esnext.asynciterable to the tsconfig.json
Adding esnext to the tsconfig.json
But none of them has worked.
package.json
"dependencies": {
"async": "^2.6.0",
"body-parser": "^1.18.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"ejs": "^2.5.7",
"errorhandler": "^1.5.0",
"express": "^4.16.2",
"express-graphql": "^0.6.12",
"graphql": "^0.13.2",
"graphql-tools": "^3.1.1",
"ldapjs": "^1.0.1",
"method-override": "^2.3.10",
"moment": "^2.20.1",
"mongoose": "^4.13.6",
"morgan": "^1.9.0",
"mysql": "^2.15.0",
"node-schedule": "^1.3.0",
"nodemiral": "^1.1.1",
"pug": "^2.0.0-rc.4",
"q": "^1.5.1",
"request": "^2.85.0",
"sendmail": "^1.2.0",
"serve-favicon": "^2.4.5",
"socket.io": "^2.0.4",
"ts-node": "^3.3.0"
},
"devDependencies": {
"#types/async": "^2.0.47",
"#types/body-parser": "^1.16.8",
"#types/chai": "^4.0.8",
"#types/chai-http": "^3.0.3",
"#types/cookie-parser": "^1.4.1",
"#types/cors": "^2.8.3",
"#types/errorhandler": "0.0.32",
"#types/ldapjs": "^1.0.3",
"#types/lodash": "^4.14.106",
"#types/method-override": "0.0.31",
"#types/mocha": "^2.2.44",
"#types/mongodb": "^2.2.16",
"#types/mongoose": "^4.7.28",
"#types/morgan": "^1.7.35",
"#types/mysql": "^2.15.3",
"#types/node-schedule": "^1.2.2",
"#types/request": "^2.47.0",
"#types/serve-favicon": "^2.2.30",
"#types/socket.io": "^1.4.32",
"chai": "^4.1.2",
"chai-http": "^3.0.0",
"grunt": "^1.0.1",
"grunt-concurrent": "^2.3.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-mocha-test": "^0.13.3",
"grunt-newer": "^1.3.0",
"grunt-nodemon": "^0.4.2",
"grunt-ts": "^6.0.0-beta.17",
"grunt-tslint": "^5.0.1",
"grunt-typedoc": "^0.2.4",
"mocha": "^4.0.1",
"mocha-typescript": "^1.1.12",
"nodemon": "^1.12.4",
"tslint": "^5.8.0",
"typescript": "^2.6.2"
}
Delete node modules then:-
npm install
npm install --save graphql-subscriptions
npm install --save #types/graphql
npm install --save #types/ws
add the following in tsconfig.json
"compilerOptions": {
"lib": [
"esnext.asynciterable"
]
I encountered the same problem and adding
"lib": ["es2017", "esnext", "esnext.asynciterable"]
to my tsconfig.json did not help, which was frustrating.
I went through lots of suggestions and eventually the answer by Shivendra solved it for me. Hope this will help others coming here in the future.