ZEIT Now - command doesn't work for NextJS - vercel

I'm trying to deploy this example NextJS app, but whenever I run the now command, I get the following error:
At C:\Users\Ben\AppData\Local\Yarn\bin\now.ps1:5 char:13
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+ ~
Unexpected token ')' in expression or statement.
At C:\Users\Ben\AppData\Local\Yarn\bin\now.ps1:8 char:3
+ if [ -x "$basedir/pwsh" ]; then
+ ~
Missing '(' after 'if' in if statement.
At C:\Users\Ben\AppData\Local\Yarn\bin\now.ps1:8 char:5
+ if [ -x "$basedir/pwsh" ]; then
+ ~
Missing type name after '['.
At C:\Users\Ben\AppData\Local\Yarn\bin\now.ps1:9 char:20
+ ... sedir/pwsh" "$basedir/../Data/global/node_modules/.bin/now.ps1" "$#"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"$basedir/../Data/global/node_modules/.bin/now.ps1"' in
expression or statement.
At C:\Users\Ben\AppData\Local\Yarn\bin\now.ps1:9 char:72
+ ... sedir/pwsh" "$basedir/../Data/global/node_modules/.bin/now.ps1" "$#"
+ ~~~~
Unexpected token '"$#"' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken
I followed all the steps by creating a now.json and next.config.js file, but I'm still unsuccessful with my attempts of deploying this example NextJS app.
To diagnose the issue, I've tried installing now globally by running this command:
yarn global add now
but this didn't help in resolving the issue.
Would there be a step I'm missing? Thanks for the help.
EDIT: btw, I am on a Windows machine and I ran the command on PowerShell.

It was a problem with the package management tool yarn. I uninstalled it from yarn and installed it globally using npm instead.

Related

I can not create a react-native project?

PS D:\reactnative> expo init Mobileapp
expo : File C:\Users\admin\AppData\Roaming\npm\expo.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
expo init Mobileapp
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
It sounds like you haven't given powershell the proper privileges to execute the expo powershell script. To verify, run Get-ExecutionPolicy in powershell. If it prints Restricted, then you haven't enable powershell to run scripts, which is why you are getting that error.
I'm not sure of what's the proper execution policy to have, but base on the link your error provided, then RemoteSigned is the one you want. Open powershell as an administrator and set it with
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

when i type command at windows terminal http-server

when i type command at windows terminal http-server following error occured
error
http-server
http-server : File C:\Users\RKanth\AppData\Roaming\npm\http-server.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
+ http-server
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Open PowerShell by Run as Administrator
Run the following command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Confirm with ‘Y’
Open PowerShell by Running as Administrator using the windows search bar.
Run the following command: Get-ExecutionPolicy
Then you can See: Restricted
Again run the following command: Set-ExecutionPolicy Unrestrict
Press y
Now you can Run again the following command and check: Get-ExecutionPolicy
Then you can See: Unrestricted
Done!!!

Running flume agent to get Twitter data

I have been trying to run a flume agent on my windows system to get twitter data. I am following this blog
https://acadgild.com/blog/streaming-twitter-data-using-flume
But, whenever i try to run the flume agent I get the follwing error -
flume-ng agent -n TwitterAgent -f ./conf/flume.conf
E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin>powershell.exe -NoProfile -InputFormat none -ExecutionPolicy unrestricted -File E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\flume-ng.ps1 agent -n TwitterAgent -f ./conf/flume.conf
Resolve-Path : Cannot find path 'E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\conf\flume.conf' because it does not exist.
At E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\flume-ng.ps1:217 char:24 + $confFile = '"' + (Resolve-Path $confFile).Path + '"' + ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (E:\apache-flume...conf\flume.conf:String) [Resolve-Path], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.ResolvePathCommand
I have tried debugging it on my own, but have failed to do so. I tried to look for this particular error but could not find it anywhere.
Does E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\conf\flume.conf exist at that location? Are you sure it's in \bin\conf\flume.conf and not \conf\flume.conf? In which case use:
flume-ng agent -n TwitterAgent -f ./../conf/flume.conf
Or (as is more common), run from the E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin folder with the command:
bin/flume-ng agent -n TwitterAgent -f ./conf/flume.conf

Following the "Getting Started" page doesn't work

Following the steps on the page: http://dotnet.github.io/core/getting-started/ on an elevated PowerShell console (Windows 10):
&{$Branch='dev';iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
downloads and installs correctly.
dnvm install -r coreclr latest -u
returns error:
Determining latest version
Unable to find any runtime packages on the feed!
At C:\Users\softw\.dnx\bin\dnvm.ps1:552 char:9
+ throw "Unable to find any runtime packages on the feed!"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to find ...es on the feed!:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to find any runtime packages on the feed!
I managed to get it working by running dmvm list and following the offer to install dmx.
Was I doing something wrong or is the documentation out of date?
Just remove latest from your command:
dnvm install -r coreclr -u
Remove -u if you want the latest stable bits. -u means unstable/dev feed.

What does "$?" mean in PowerShell

I'm very new to PowerShell. While looking up information about error handling I've found a lot of references to using "$?"
I know that it has something to do with errors but what exactly is it? And where can I read more about it?
All of my Google searches have found nothing.
From the The Essential Windows PowerShell Cheat Sheet:
Errors and Debugging: The success or failure status of the last command can be determined by checking $?
Example:
> Get-Content file-that-exists.txt
Hello world
> Write-Host $?
True
> Get-Content file-that-does-not-exist.txt
Get-Content : Cannot find path 'C:\file-that-does-not-exist.txt' because it does not exist.
At line:1 char:1
+ Get-Content file-that-does-not-exist.txt
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\file-that-does-not-exist.txt:String) [Get-Content], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
> Write-Host $?
False
Just after asking this I discovered the command
"Get-Help -name about_automatic_variables"
This gives information about every automatic variable in powershell, it's very helpful