Node cannot find module "fs" when using storybook - storybook

I get an error trying to start storybook app: index.js:56 Unexpected error while loading stories.tsx: Cannot find module 'fs'
Node version: 16.17.0
"#storybook/addon-actions": "^6.5.10",
"#storybook/addon-essentials": "^6.5.10",
"#storybook/addon-interactions": "^6.5.10",
"#storybook/addon-links": "^6.5.10",
"#storybook/builder-webpack5": "^6.5.10",
"#storybook/manager-webpack5": "^6.5.10",
"#storybook/react": "^6.5.10",
"#storybook/testing-library": "^0.0.13",

Related

Default install of NextJS 13 (13.0.7) "app" method doesn't work

I'm trying to create a brand new project using NextJS 13 to try out the new "app" folder approach. I use the following commands.
npx create-next-app#latest --experimental-app
npm run dev
With no other changes whatsoever, I get the error below shown in the browser when I try to browse to localhost:3000.
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'call')
Call Stack
options.factory
file:///D:/Projects/Personal/leeconlin-website/.next/static/chunks/webpack.js (710:31)
__webpack_require__
/_next/static/chunks/webpack.js (37:33)
fn
file:///D:/Projects/Personal/leeconlin-website/.next/static/chunks/webpack.js (365:21)
require
node_modules\next\dist\client\image.js (7:15)
./node_modules/next/dist/client/image.js
file:///D:/Projects/Personal/leeconlin-website/.next/static/chunks/app/page.js (39:1)
options.factory
/_next/static/chunks/webpack.js (710:31)
__webpack_require__
file:///D:/Projects/Personal/leeconlin-website/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (365:21)
__webpack_require__
node_modules\next\dist\client\app-index.js (26:16)
requireModule
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (142:0)
initializeModuleChunk
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (427:0)
readChunk
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (252:0)
mountLazyComponent
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (23079:0)
beginWork
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (24792:0)
beginWork$1
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (32185:0)
performUnitOfWork
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (31082:0)
workLoopConcurrent
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (31068:0)
renderRootConcurrent
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (31026:0)
performConcurrentWorkOnRoot
node_modules\next\dist\compiled\react-dom\cjs\react-dom.development.js (29983:0)
workLoop
node_modules\next\dist\compiled\scheduler\index.js (10:3921)
flushWork
node_modules\next\dist\compiled\scheduler\index.js (10:3629)
MessagePort.performWorkUntilDeadline
node_modules\next\dist\compiled\scheduler\index.js (10:1811)
What am I missing?
The current solution is to use next.js 13.0.6, cause there's something wrong with 13.0.7.
"dependencies": {
"#next/font": "13.0.6",
"#types/node": "18.11.17",
"#types/react": "18.0.26",
"#types/react-dom": "18.0.9",
"eslint": "8.30.0",
"eslint-config-next": "13.0.6",
"next": "13.0.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.4"
}
if you still have an error, please delete your .next folder and node_modules folder, run npm i and try again.
I found the solution here:
TypeError: Cannot read properties of undefined (reading 'call') on Next.js

react-native-neomorph-shadows : Error in iphone 12

Hi I am facing issue with react-native-neomorph-shadows library. App crashes immediately after build being successful. I am not sure what is the issue.
macOS version: 11.2.3
Edit-1
Package.json dependency:
"#react-native-community/art": "^1.2.0",
"#react-native-community/masked-view": "^0.1.11",
"#react-navigation/bottom-tabs": "^5.11.13",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.5",
"react": "17.0.1",
"react-native": "0.64.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-linear-gradient": "^2.5.6",
"react-native-neomorph-shadows": "^1.0.0",
"react-native-reanimated": "^2.2.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.4.0"
Error:
error: Error: Unable to resolve module ./src/ShadowFlex from /Users/manikanttiwari/Desktop/test/app/node_modules/react-native-neomorph-shadows/index.js
Hi I was able to solve this problem. Please do npm i https://github.com/react-native-art/art.git instead of react-native link #react-native-community/art. This will solve the problem.

error navigator is not defined in node modules

I ran. while using Next.js.
npm run dev
(next dev)
And get this error.
ReferenceError: navigator is not defined
at getChromeVersion (D:\zummon\page\node_modules\jest-worker\node_modules\supports-color\browser.js:5:68)
at Object.<anonymous> (D:\zummon\page\node_modules\jest-worker\node_modules\supports-color\browser.js:14:22)
at Module._compile (internal/modules/cjs/loader.js:1144:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
at Module.load (internal/modules/cjs/loader.js:993:32)
at Function.Module._load (internal/modules/cjs/loader.js:892:14)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at _supportsColor (D:\zummon\page\node_modules\jest-worker\build\workers\ChildProcessWorker.js:39:16)
at ChildProcessWorker.initialize (D:\zummon\page\node_modules\jest-worker\build\workers\ChildProcessWorker.js:136:24)
code in package.json
{
"dependencies": {
"#heroicons/react": "^1.0.1",
"#tailwindcss/forms": "^0.3.3",
"#tailwindcss/typography": "^0.4.1",
"gray-matter": "^4.0.3",
"next": "^10.2.3",
"next-mdx-remote": "^3.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"#types/react": "^17.0.11",
"autoprefixer": "^10.2.6",
"postcss": "^8.3.5",
"tailwindcss": "^2.2.2",
"typescript": "^4.3.4"
}
}
I also downloaded new version for node.js (v13.6.0) before this happened, if this in case.
I now can't see my editing work, please. I wanna know how to fix this situation.
I found the same problem with node.js version 13.6.0. I changed to 14.17.0 and the problem is fixed as well.

Android firestore could not reach backend error in react native

I have been looking for the solution about this issue, but I couldn't find it until now.
It is such a weird issue.
I tried with react-native 0.56.0 at first, it compiles well, and then this error is occured on the android device.
firestore(5.5.0) could not reach backend
However, the problem is that the error doesn't happen to android simulator. It only happens to android device. (It's really weird)
So, I tried with react-native 0.57.1 in this time, then this error occured.
And it's printed that The development server returned response error code: 500 on android device screen.
error: bundling failed: Error: Unable to resolve module schedule/tracking from /Users/jeonmingyu/work/foodup-mobile-RN/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js: Module schedule/tracking does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: watchman watch-del-all.
2. Delete the node_modules folder: rm -rf node_modules && npm install.
3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.
at ModuleResolver.resolveDependency (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:209:1301)
at ResolutionRequest.resolveDependency (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:83:16)
at DependencyGraph.resolveDependency (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/node-haste/DependencyGraph.js:238:485)
at Object.resolve (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/lib/transformHelpers.js:180:25)
at dependencies.map.result (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/DeltaBundler/traverseDependencies.js:311:29)
at Array.map ()
at resolveDependencies (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/DeltaBundler/traverseDependencies.js:307:16)
at /Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/DeltaBundler/traverseDependencies.js:164:33
at Generator.next ()
at step (/Users/jeonmingyu/work/foodup-mobile-RN/node_modules/metro/src/DeltaBundler/traverseDependencies.js:266:307)
Here's my package.json
package.json
"dependencies": {
"#firebase/firestore": "^0.8.1",
"firebase": "^5.5.1",
"immutable": "^3.8.2",
"loaders.css": "^0.1.2",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"native-base": "^2.7.2",
"react": "16.3.1",
"react-geocode": "^0.1.2",
"react-loaders": "^3.0.1",
"react-native": "^0.57.0",
"react-native-app-intro-slider": "^0.2.4",
"react-native-fast-image": "^4.0.14",
"react-native-loader": "^1.2.1",
"react-native-maps": "^0.21.0",
"react-native-phone-call": "^1.0.7",
"react-native-side-menu": "^1.1.3",
"react-native-swiper": "^1.5.13",
"react-navigation": "^2.3.1",
"react-redux": "^5.0.7",
"react-redux-firebase": "^2.1.6",
"redux": "^4.0.0",
"redux-actions": "^2.4.0",
"redux-devtools-extension": "^2.13.5",
"redux-firestore": "^0.5.7",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0",
"remote-redux-devtools": "^0.5.13"
},
"devDependencies": {
"babel-jest": "23.0.1",
"babel-preset-react-native": "^5.0.2",
"jest": "23.1.0",
"lint-staged": "^7.2.2",
"node-sass": "^4.9.2",
"react-native-sass-transformer": "^1.2.2",
"react-test-renderer": "16.3.1",
"redux-devtools-extension": "^2.13.5"
}
If anyone knows about it and has solution, please share your solution.
It drives me crazy! :(

Cannot use/import npm packages in Meteor

I am not able to do:
import SimpleSchema from 'simpl-schema';
or to import any other npm package with this command. I have already installed the package via meteor npm install --save simpl-schema.
I have also tried to import other npm dependencies like:
import moment from 'moment';
Therefore, I think that I generally missed something important to be able to require NPM packages in my client-side code or that I am using a wrong structure?
I get the error:
Uncaught SyntaxError: Unexpected identifier
in the browser console.
Edit
I have called meteor npm install before running the app.
If I code this line import moment from 'moment'; on a server side js-file, I get the following error:
app\server\startup\profilemanagement.js:1
(function(NPM,Assets){(function(){import moment from 'moment';
SyntaxError: Unexpected token import at C:...meteor\local\build\programs\server\boot.js:392:18 at
Array.forEach () at Function..each..forEach
(C:...meteor\packages\meteor-tool\1.6.0:1\mt-os.windows.x86_64\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11) at C:...meteor\local\build\programs\server\boot.js:220:5 at
C:...meteor\local\build\programs\server\boot.js:463:5 at
Function.run
(C:...meteor\local\build\programs\server\profile.js:510:12) at
C:...meteor\local\build\programs\server\boot.js:462:11
I am not sure if I installed the babel packages correctly. I think something went wrong there. Here is my package.json:
{
"dependencies": {
"abbrev": "^1.1.0",
"addressparser": "^1.0.1",
"ajv": "^5.2.2",
"ansi-regex": "^3.0.0",
"aproba": "^1.2.0",
"are-we-there-yet": "^1.1.4",
"asn1": "^0.2.3",
"assert-plus": "^1.0.0",
"asynckit": "^0.4.0",
"aws-sign2": "^0.7.0",
"aws4": "^1.6.0",
"babel-runtime": "^6.26.0",
"balanced-match": "^1.0.0",
"bcrypt": "^1.0.3",
"bcrypt-pbkdf": "^1.0.1",
"block-stream": "0.0.9",
"boom": "^5.2.0",
"brace-expansion": "^1.1.8",
"buildmail": "^4.0.1",
"caseless": "^0.12.0",
"chart.js": "^2.7.0",
"chartjs-color": "^2.2.0",
"cloudinary": "^1.9.0",
"co": "^4.6.0",
"code-point-at": "^1.1.0",
"color-convert": "^1.9.0",
"color-name": "^1.1.3",
"combined-stream": "^1.0.5",
"concat-map": "0.0.1",
"console-control-strings": "^1.1.0",
"core-js": "^2.5.1",
"core-util-is": "^1.0.2",
"cryptiles": "^3.1.2",
"dashdash": "^1.14.1",
"debug": "^3.0.1",
"deep-extend": "^0.5.0",
"delayed-stream": "^1.0.0",
"delegates": "^1.0.0",
"ecc-jsbn": "^0.1.1",
"extend": "^3.0.1",
"extsprintf": "^1.3.0",
"fast-deep-equal": "^1.0.0",
"fontawesome": "^4.7.2",
"forever-agent": "^0.6.1",
"form-data": "^2.3.1",
"fs.realpath": "^1.0.0",
"fstream": "^1.0.11",
"fstream-ignore": "^1.0.5",
"gauge": "^2.7.4",
"getpass": "^0.1.7",
"glob": "^7.1.2",
"graceful-fs": "^4.1.11",
"har-schema": "^2.0.0",
"har-validator": "^5.0.3",
"has-unicode": "^2.0.1",
"hawk": "^6.0.2",
"hoek": "^4.2.0",
"http-signature": "^1.2.0",
"iconv-lite": "^0.4.19",
"inflight": "^1.0.6",
"inherits": "^2.0.3",
"ini": "^1.3.4",
"is-fullwidth-code-point": "^2.0.0",
"is-typedarray": "^1.0.0",
"isarray": "^2.0.2",
"isstream": "^0.1.2",
"jasny-bootstrap": "^3.1.3",
"jodid25519": "^1.0.2",
"jsbn": "^1.1.0",
"json-schema": "^0.2.3",
"json-schema-traverse": "^0.3.1",
"json-stable-stringify": "^1.0.1",
"json-stringify-safe": "^5.0.1",
"jsonify": "0.0.0",
"jsprim": "^1.4.1",
"libbase64": "^0.2.0",
"libmime": "^3.1.0",
"libqp": "^1.1.0",
"lodash": "^4.17.4",
"mailcomposer": "^4.0.2",
"meteor-node-stubs": "^0.2.11",
"mime-db": "^1.30.0",
"mime-types": "^2.1.17",
"minimatch": "^3.0.4",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"moment": "^2.18.1",
"ms": "^2.0.0",
"nan": "^2.7.0",
"node-pre-gyp": "^0.6.37",
"nodemailer": "^4.1.0",
"nodemailer-fetch": "^2.1.0",
"nodemailer-shared": "^2.0.0",
"nopt": "^4.0.1",
"npmlog": "^4.1.2",
"number-is-nan": "^1.0.1",
"oauth-sign": "^0.8.2",
"object-assign": "^4.1.1",
"object-inspect": "^1.3.0",
"object-keys": "^1.0.11",
"once": "^1.4.0",
"os-homedir": "^1.0.2",
"os-tmpdir": "^1.0.2",
"osenv": "^0.1.4",
"path-is-absolute": "^1.0.1",
"path-parse": "^1.0.5",
"performance-now": "^2.1.0",
"process-nextick-args": "^1.0.7",
"punycode": "^2.1.0",
"q": "^1.5.0",
"qs": "^6.5.1",
"rc": "^1.2.1",
"readable-stream": "^2.3.3",
"regenerator-runtime": "^0.11.0",
"request": "^2.82.0",
"resolve": "^1.4.0",
"resumer": "0.0.0",
"rimraf": "^2.6.2",
"safe-buffer": "^5.1.1",
"semver": "^5.4.1",
"set-blocking": "^2.0.0",
"signal-exit": "^3.0.2",
"sntp": "^2.0.2",
"sshpk": "^1.13.1",
"string-width": "^2.1.1",
"string.prototype.trim": "^1.1.2",
"string_decoder": "^1.0.3",
"stringstream": "0.0.5",
"strip-ansi": "^4.0.0",
"strip-json-comments": "^2.0.1",
"sweetalert": "^1.1.3",
"tape": "^4.8.0",
"tar": "^4.0.1",
"tar-pack": "^3.4.0",
"through": "^2.3.8",
"tough-cookie": "^2.3.2",
"tunnel-agent": "^0.6.0",
"tweetnacl": "^1.0.0",
"uid-number": "0.0.6",
"util-deprecate": "^1.0.2",
"uuid": "^3.1.0",
"verror": "^1.10.0",
"wide-align": "^1.1.2",
"wow.js": "^1.2.2",
"wrappy": "^1.0.2",
"yallist": "^3.0.2"
}
}
Second edit
It seems to be that (maybe since the last update?) I have a major issue with the meteor installation and its npm dependencies. I am not able to create a new meteor project due to this error:
Error: Error: Could not install npm dependencies for test-packages:
Command failed: C:\WINDOWS\system32\cmd.exe /c
C:\Users...\AppData\Local.meteor\packages\meteor-tool\1.6.0._1\mt-os.windows.x86_64\dev_bundle\bin\npm.cmd
install npm ERR! code ENOGIT npm ERR! No git binary found in $PATH npm
ERR! npm ERR! Failed using git. npm ERR! Please check if you have git
installed and in your PATH.
You can check this error here:
https://github.com/meteor/meteor/issues/8585. It tells that me that no Npm dependencies can be installed because of not finding the Git-path.
However, the solutiuon to reinstall Git did not work for me. So, I think something went generally wrong since the last meteor update. Maybe the only solution is to reinstall meteor completely or use an older version? I started this project from my computer with an older meteor version and uninstalling and reinstalling Babel did not make any difference.
Ok, got it! Although I don´t know exactly what produced the error, I could solve the issue by creating a new meteor project with the --bare flag (so now I know that all npm dependencies are installed correctly to ensure that I can use 'import') and copied my code into the project. However, than I got another error message which told me that my bootstrap is not compatible with my jquery version. Before solving this, I had to delete codemirror in my client/vendor folder, which produces another error
Uncaught Error: Cannot find module ‘…/…/lib/codemirror’
Than I installed jquery#2.2.4 plus all required datatable npm dependencies I use in my code to keep the compatibility of my applied bootstrap and jquery. Now I can use import SimpleSchema from 'simpl-schema' and all other imports and no more errors occure.
So lastly, some npm and/or packages were wrong and the initial error could be solved by creating a new meteor project. The other errors were related to bootstrap/jquery compatibility and codemirror.

Resources