Running Storybook on an Angular Library Project - javascript

I created a new Angular Workspace.
ng new workspace --create-application=false
cd workspace
And then generated a library within the workspace.
ng g library lib
I also generated a playground for testing the library.
ng g application playground
Then I initialized storybook and tried to run it.
npx storybook init
npm run storybook
When attempting to run storybook it logs this error:
info => Using angular project "lib:build" for configuring Storybook
ERR! Error: error TS6053: File '../false' not found.
ERR!
ERR! at readTsconfig (/Users/oleersoy/Temp/workspace/node_modules/#angular-devkit/build-angular/src/utils/read-tsconfig.js:51:15)
ERR! at async configureI18nBuild (/Users/oleersoy/Temp/workspace/node_modules/#angular-devkit/build-angular/src/utils/i18n-options.js:125:22)
ERR! at async generateI18nBrowserWebpackConfigFromContext (/Users/oleersoy/Temp/workspace/node_modules/#angular-devkit/build-angular/src/utils/webpack-browser-config.js:67:36)
ERR! Error: error TS6053: File '../false' not found.
ERR!
ERR! at readTsconfig (/Users/oleersoy/Temp/workspace/node_modules/#angular-devkit/build-angular/src/utils/read-tsconfig.js:51:15)
ERR! at async configureI18nBuild (/Users/oleersoy/Temp/workspace/node_modules/#angular-devkit/build-angular/src/utils/i18n-options.js:125:22)
ERR! at async generateI18nBrowserWebpackConfigFromContext (/Users/oleersoy/Temp/workspace/node_modules/#angular-devkit/build-angular/src/utils/webpack-browser-config.js:67:36)
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
info => Loading presets
✔ Would you like to send crash reports to Storybook? … yes
How can I fix this?

Related

I am new to react, previously I created react apps but not trying to create a react app but after taking a long time it is giving an error

Previously used this command;
npx create-react-app 'project_name'
-but now this is giving error, used other commands as;
npx create-react-app#latest 'project_name'
npm create-react-app 'project_name'
node version is: v16.17.0
npm version: 9.1.2
same error, then tried to use uninstall react globally and installed it again and tried
npx create-react-app 'project_name'
and having same error again..
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#typescript-eslint%2ftypescript-estree: aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ST\AppData\Local\npm-cache\_logs\2022-11-29T19_03_34_604Z-debug-0.log
only packages.json file is created and at failure it is also deleted...
As this command was working fine just a few days ago
npx create-react-app
I am new to this framework if there is a mistake kindly help me along..
It clearly states that your error comes from a network connection. It may be caused by a VPN. Anyway, if you are new to React and if I may suggest a better solution for you to start a project... CRA is outdated nowadays. Use Vite. Just run this
npm create vite#latest some-react-app-name --template react

electron forge not making exe

im useing the latest version of electron forge to make my app, so to make sure that the setup worked i ran the make command and it didn't work.
error:
PS D:\javascript\testing\New folder> cd my-app
PS D:\javascript\testing\New folder\my-app> npm run make
my-app#1.0.0 make D:\javascript\testing\New folder\my-app
electron-forge make
✔ Checking your system
✔ Resolving Forge Config
An unhandled rejection has occurred inside Forge:
Error: Could not find module with name: #electron-forge/maker-squirrel. Make sure it's listed in the
devDependencies of your package.json
at _default (D:\javascript\testing\New folder\my-app\node_modules#electron-forge\core\src\api\make.ts:132:15)
at D:\javascript\testing\New folder\my-app\node_modules#electron-forge\cli\src\electron-forge-make.ts:44:5
Electron Forge was terminated. Location:
{}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#1.0.0 make: electron-forge make
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#1.0.0 make 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! C:\Users\nycas\AppData\Roaming\npm-cache_logs\2021-09-04T01_06_58_366Z-debug.log
PS D:\javascript\testing\New folder\my-app>
i have #electron-forge/maker-squirrel and its a brand new project that I literally just made
help is appreciated.

Heroku Deploy React Error: Didn't get a result from child compiler ./src/App.css

Looking to deploy a react app on Heroku but
-----> Build
Running build
> crmprototype#0.1.0 build /tmp/build_0b3e74dd_
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/App.css
Error: Didn't get a result from child compiler
at runMicrotasks (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! crmprototype#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the crmprototype#0.1.0 build 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! /tmp/npmcache.gNVt2/_logs/2020-10-30T02_00_17_191Z-debug.log
Git repo is here
https://github.com/marcoantonio123456/wivo-testing
I can't seem to find what is wrong with my App.css file
in your css file. in the #font-face should be
src: url(./fonts/Europa-Bold/Europa-Bold.woff);
before you were pointing to src: url(./fonts/Europa-Bold/Europa-Bold.css); which is not a font file, its a css file
The import css file seems good to me, may it be because you committed the build folder and the .css file isn't there? there build folder shouldn't be committed.

TypeError: Cannot read property 'config' of null

After copied my Angular project from my local computer to my Linux server, I tried to run the project using ng serve and it didn't work. Instead it opened a new file in an editor in the console.
Then I researched and came up with npm start. However, that also not working. Gives me the following error.
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
at Class.run (/var/www/html/node1/social2/client/node_modules/angular-cli/tasks/serve.js:22:61)
at /var/www/html/node1/social2/client/node_modules/angular-cli/commands/serve.run.js:22:22
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#0.0.0 start: `start http://xxx.xx.xx.xx:4200 & ng serve -port 4200`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#0.0.0 start 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! /root/.npm/_logs/2018-01-23T18_49_07_743Z-debug.log
And I have the .angular-cli.json file also there. It's not missing.
What could be the reason for this ? And any solution.?
You may have to install angular cli on your linux server if you want to run it this way.
npm install #angular/cli -g
However, you may want to build your project for production if you want to serve it. Build it locally and push the built 'dist' folder to your server:
npm run ng build -prod
Try this
npm install -g #angular/cli

NodeJS (Firebase): Cannot import custom class

I am working on a Firebase server-side code for sending push notifications. To make the code clean, I decided to move some functions to another class which I created and called notificationFunctions.js.
When I do const notificationFunctions = require('notificationFunctions'); at the top of my index.js and call the function from within my sendNotification function, I get an error when deploying my project to the cloud:
⚠ functions[sendNotifications]: Deployment error.
Build failed: exit status 1
npm ERR! Linux 4.4.0-108-generic
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "--global-style" "--production" "--fetch-retries=5" "--fetch-retry-factor=2" "--fetch-retry-mintimeout=1000" "install" "/workspace"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/notificationFunctions
npm ERR! 404
npm ERR! 404 'notificationFunctions' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can no longer contain capital letters
npm ERR! 404 It was specified as a dependency of 'functions'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR! /workspace/npm-debug.log
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
I have also added "notificationFunctions": "1.0.0" in my package.json and moved the custom function to node_modules folder.
What is the right way of adding a custom class to Firebase NodeJS?
Edit:
When I follow Doug Stevenson's advise and I remove the custom class from my package.json, and move the class to the same directory as index.js, I still keep getting an error:
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error parsing triggers: Cannot find module 'notificationFunctions'
Try running "npm install" in your functions directory before deploying.
Edit 2
Ok. I figured I have to change the way I import my class to require('./notificationFunctions') and this removes all errors when deploying the project.
Once I run the code on the cloud however, I get this error: FIREBASE WARNING: Exception was thrown by user callback. TypeError: notificationFunctions.getNotificationPayload is not a function
The way I call the function from my code is: const payload = notificationFunctions.getNotificationPayload(userLanguage, senderName, groupName, messageContent, messageType);
If you add code to your project in the functions folder, you don't need to make any changes to your package.json dependencies. npm dependencies are only required for modules that are published to the NPM registry.
What your build is doing now is looking for a node module called "notificationFunctions" on NPM, and that obviously doesn't exist there. You should just put your module code along with all the other code under functions and require() it directly from there.
Also, bear in mind that node_modules is not deployed with your code. Cloud Functions will fetch all the npm dependencies on the server side and make them available to your code.

Categories