Trying to install Storybook into my Atom project - atom-editor

I'm trying to install Storybook in my project's root directory through the Atom terminal, but the command that I'm using with Storybook CLI to install is not working. How can I resolve this issue?
PS C:\Users\khari\github\pancake-frontend> npx sb init
npx : The term 'npx' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1
+ npx sb init
+ ~~~
+ CategoryInfo : ObjectNotFound: (npx:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Related

Can not recognize dotenv while using dotenv -e .env.dev yarn dev in next.js project

I built a next.js project and installed dotenv through
yarn global add dotenv-cli
I also installed all the package with yarn and they were all installed successfully, but when I run:
dotenv -e .env.dev yarn dev
it returns:
dotenv : The term 'dotenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ dotenv -e .env.dev yarn dev
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (dotenv:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
You'll need to fix your powershell path to use global NPM packages.
Also just to note, next.js supports .env files out of the box, so dotenv-cli shouldn't be needed unless you want to create .env files through the terminal.

how to fix firebase "command not found" error

Hi I have this problem when attempting to add firebase package, getting the error below...
found 385 vulnerabilities (366 low, 7 moderate, 12 high)
run `npm audit fix`` to fix them, or `nom audit` for details
PS D: \Downloads\ codecanyon-G8bOFJ14-superstore-grocery-store-super-shop-management-pos\main-files\superstore-1.1> firebase init functions
firebase: The term 'firebase' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ firebase init functions
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (firebase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
It looks like you didn't install the Firebase CLI yet.
If you have NPM installed locally, you can install the Firebase CLI with:
npm install firebase-tools -g
Or you can use the pre-built binary for Windows that's linked from the installation instructions. If you're not too comfortable with NPM yet, I recommend this as an easier way to get started.
npm config get prefix
In my case it returns a path C:\Program Files\Git\usr\local. In your case it may be return different path. Then go to the path and find node_modules -> npm and then copy the path.
Go to path C:\Program Files\Git\usr\local\node_modules\npm
Clikedit the system environment variable
Click environment variable
From the bottom system variable find the path
click edit in the path variable
Click new and paste the path point 3 in my case
Finally click ok and close command line
Reopen command line and type firebase --version. It will then return the version you have install.

VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

I design websites in VSC and PowerShell is my default terminal.
After updating and deploying a website to firebase earlier, I was prompted to update firebase tools - which I did using npm. Immediately after I cannot run/access any firebase scripts wthout the folllowing error:
firebase : File C:\Users\mada7\AppData\Roaming\npm\firebase.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1
firebase
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I've spent a few hours searching around and can't find a solid answer the problem. Many threads are several years old and I find it bizarre I've not had this problem in the past year until today.
I can still access firebase scripts if I set my default terminal to cmd.
Assuming the problem was related to firebase-tools I've carried on working but have now updated vue.js and get the error again when trying to run any vue commands in powershell:
vue : File C:\Users\mada7\AppData\Roaming\npm\vue.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1
vue
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
VSCode Version:
Version: 1.37.1 (user setup)
Commit: f06011a
Date: 2019-08-15T16:17:55.855Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
OS Version:
Windows 10 Home
Version - 1903
OS build - 18362.295
I've been reading around and seen many threads around permissions for scripts, but I haven't changed any - indeed the PowerShell scripts worked right up until I updated my packages. No other settings touched in the mean time. I don't want to be changing PowerShell settings unnecessarily.
Just delete firebase.ps1 file:
File C:\Users\<your account>\AppData\Roaming\npm\firebase.ps1
This is a powershell security policy, to fix it, run Powershell as administrator and run the following
PS C:\> Set-ExecutionPolicy RemoteSigned
If you don't want to run the command as an administrator but just for the current user, you can add a scope like below
PS C:\> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
The stricter the policy, the more secure your system becomes.
You can change RemoteSigned to other options like: Restricted, AllSigned, RemoteSigned, Unrestricted
Source: https://tecadmin.net/powershell-running-scripts-is-disabled-system/
Alternatively you can modify C:\Program Files\PowerShell\7\powershell.config.json using a text editor and add or modify the following section.
{
....
"Microsoft.PowerShell:ExecutionPolicy": "RemoteSigned"
}
A little clarification: when you run PowerShell as Admin, in most cases you don't need to note a path. Just type:
Set-ExecutionPolicy RemoteSigned
then press "A", then "Enter"
Also, one thing worth mentioning is that you need to open PowerShell as Admin and then change the policy like so.
PS C:\> Set-ExecutionPolicy RemoteSigned
Reference - Using the Set-ExecutionPolicy Cmdlet
I didn't have any problem with npm but the same problem is in the using yarn on windows.
In my case, I deleted yarn.ps1 and it worked fine for me:
File path:
C:\Users\<your account>\AppData\Roaming\npm\yarn.ps1
This could be due to the current user having an undefined ExecutionPolicy.
You could try the following
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
For those who work with VS Code and get the about_Execution_Policies error. In my case with the command ncu -u (npm-check-updates).
Try it with CMD:
Simply execute the command in CMD again.
If this works, the security settings can remain as they are.
search for powershell
right click and run as administration
run this simple command Set-ExecutionPolicy RemoteSigned
Press A And Enter
go to code and run yarn add <YOUR_MODULE>
press Enter.
congratulations now it would be done.
I also had this problem in the powershell and i used the following :
then i again installed the serve package.
Set-ExecutionPolicy -Scope CurrentUser
and then i chose Unrestricted and gave serve command and it worked.
File C:\Users\xxxx\AppData\Roaming\npm\vue.ps1 cannot be loaded because running scripts is disabled on this system.
I had the same error message with vue.
After running the below command successfully
npm install -g #vue/cli
when i ran commands like vue or vue --version, i received that error message.
This is how i fixed it:
I pressed the buttons windows + E, clicked view, checked hidden items.
Then, i went to C:\Users\xxxx\AppData\Roaming\npm folder and deleted the vue file of type 'windows powershell script'.
After that, i ran the commands vue and vue --version succesfully.
Hope this helps.
Instead of using PowerShell and changing its security settings, you can simply use cmd instead. It will not give an error and your all commands will run smoothly.
Remember PowerShell is stronger and sensitive. So, Microsoft by default disables running .ps1 files as it can cause a security issue and harm your pc. So, that's why you should try to use cmd instead of changing PowerShell security.
Open Powershell from your VS code and then execute this command on that:
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
this worked for me. it will ask you for CLI authentication.
Open Powershell and execute this command:
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Delete firebase.ps1 located in:
C:\Users\<your account>\AppData\Roaming\npm\
In case you don't have firebase.ps1 delete vue.ps1
If you have this issue in VS Code, close PowerShell terminal and open a Command Prompt terminal instead.
PS C:\> Set-ExecutionPolicy RemoteSigned
It's works for me
I don't know if it can help with Firebase but I had a similar problem installing Vue with *>npm install -g #vue/cli* .
Long story short:
I deleted vue.ps1 from C:\Users\XXX\AppData\Roaming\npm\ and installed it locally (without -g) from powershell terminal inside VsCode *>npm install #vue/cli*.
After that I could use Vue commands without problems.
Just delete Power Shell file:
C:\Users\<your account>\AppData\Roaming\npm\**vue**
Delete this last vue file, extension of this file is power shall
after delete run command it's work.
On a computer with German as the default language the error might look like:
vue : Die Datei "C:\Program Files\nodejs\vue.ps1" kann nicht geladen werden, da die Ausführung von Skripts auf diesem System deaktiviert ist. Weitere Informationen finden Sie unter "about_Execution_Policies"
(https:/go.microsoft.com/fwlink/?LinkID=135170).
In Zeile:1 Zeichen:1
+ vue --version
+ ~~~
+ CategoryInfo : Sicherheitsfehler: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I had to search for "vue" "PSSecurityException" to find this thread.
I installed a new node version with nvm-windows. Then I installed vue-cli. After that a simple vue --version led to the error above.
It seems like the removal of the vue.ps1 file helped to resolve my problem like some users suggested above.
I had a similar issue during installation of grunt and yarn.
"yarn : File C:\AppData\Roaming\npm\yarn.ps1 cannot be loaded. The file C:\AppData\Roaming\npm\yarn.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and
setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170."
When I checked the AppData\Roaming\npm* folder, I could see grunt script being generated as:
Windows Command Script
Windows Powershell Script
Upon deletion of the powershell script, the error was gone.
Just open cmd as administrator and go to your project
then execute your firebase command

install .net framework 4.7.2 in docker

I'm new to .Net Environment, I'm trying to implement docker here for my firm. They were using 4.5 earlier so I used the following statement in my dockerfile:
RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
Install-WindowsFeature Web-Asp-Net45
Now, I want to do the same for framework 4.7.2 - I thought it will work if I run the statements like :
RUN Install-WindowsFeature NET-Framework-472-ASPNET ; \
Install-WindowsFeature Web-Asp-Net472
But it's not working this way instead shows the following error :
Install-WindowsFeature : ArgumentNotValid: The role, role service, or feature
name is not valid: 'NET-Framework-472-ASPNET'. The name was not found.
At line:1 char:1
+ Install-WindowsFeature NET-Framework-472-ASPNET ; Install-WindowsFeat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (NET-Framework-472-ASPNET:Strin
g) [Install-WindowsFeature], Exception
+ FullyQualifiedErrorId : NameDoesNotExist,Microsoft.Windows.ServerManager
.Commands.AddWindowsFeatureCommand
Please help me with the same. I am really stuck and can't find anything on the internet.
Instead of Installing the NET-Framework yourself, you could use
FROM microsoft/aspnet
or
FROM microsoft/dotnet-framework:4.7.2
to use an image with dotnet framework already installed.
or whatever version you need.
See https://hub.docker.com/u/microsoft/
for all the images on docker hub
So i searched for a few things online and i found out that there is one solution that if i mention to install chocolatey on powershell inside my docker file. This reference, I have received from the this post by anothony chu:
so i used:
# Install Chocolatey
RUN #powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:ChocolateyUseWindowsCompression='false'; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN powershell add-windowsfeature web-asp-net45 \
&& choco install dotnet4.7 --allow-empty-checksums -y \
in my docker file and now all works fine and good.

Dotnet new - webpack.js missing

I downloaded .NET Core SDK version 2.1 and I ran :
dotnet new angular -n testAngular
... and the project was created successfully.
Then I ran:
cd testAngular
dotnet run
Which resulted in the following error :
EXEC : error : Cannot find module
C:\Users\OLE\source\repos\testAngular\node_modules\webpack\bin\webpack.js
How can I avoid this error? Adding an empty webpack.js didn't work. Why was webpack.js not added, when running dotnet new ? What should I put in it?
Thanks.
Your node_modules library doesn't have webpack installed.
Could be two reasons
Your package.json includes webpack, and you never installed it.
Inside testAngular run
npm install
Your project doesn't include webpack.
Inside testAngular run
npm install webpack -D
If you can't run npm, then install it from nodejs

Resources