How do I resolve this error running create-nuxt-app? - node.js

Nuxt.js/Vue.js app: command not found
Error:
dell#Himanshu-sharma:~/Workspace/Web/vue-nuxt$ sudo npm i create-nuxt-app -g[sudo] password for dell:
/home/dell/.npm-global/bin/create-nuxt-app -> /home/dell/.npm-global/lib/node_modules/create-nuxt-app/cli.js
create-nuxt-app#1.2.2
added 413 packages in 28.445s
dell#Himanshu-sharma:~/Workspace/Web/vue-nuxt$ create-nuxt-app myapp
bash: create-nuxt-app: command not found

The directory where it installed/linked the tool needs to be in your PATH variable if you want to call it just by its name.
So either:
Add /home/dell/.npm-global/bin to your PATH
Call it via its "full name/path": /home/dell/.npm-global/bin/create-nuxt-app myapp

Related

Getting 403 Forbidden from Artifact Registry While Deploying a Cloud Function

What I Want to Do
I have published my private npm package onto Artifact Registry, and the diagram below is what I'm trying to do.
Basically I want to use the private package from both project-staging and project-production. So my package.json looks something like:
"dependencies": {
"#<scope>/private_package": "^1.0.0",
},
What I Did
Giving Permission to Cloud Build Service Account
I gave artifactregistry.reader permission to both <project-staging_id>#cloudbuild.gserviceaccount.com and <project-production_id>#cloudbuild.gserviceaccount.com under IAM menu in project-common.
.npmrc Preparation
cd path/to/project_directory
gcloud artifacts print-settings npm \
--project=project-common \
--repository=private_package \
--location=<location> \
--scope=#<scope>
vim .npmrc
# => add the output of above gcloud command
npx google-artifactregistry-auth .npmrc
deploy
gcloud config configurations activate project-staging
gcloud functions deploy <function_name> --gen2 --region=<region> --trigger-http --runtime=nodejs16 --entry-point=<entry_point>
This gives me the following error.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed with status: FAILURE and message: npm ERR! code E403
npm ERR! 403 403 Forbidden - GET https://<URL>.tgz - Permission "artifactregistry.repositories.downloadArtifacts" denied on resource "<resource_name>" (or it may not exist)
I don't know why I'm getting this even though
<project-staging_id>#cloudbuild.gserviceaccount.com has artifactregistry.reader permission.
Is there anything else I should do?
Normally the role roles/artifactregistry.reader is sufficient to download packages from the repo on project_common.
If project_staging and project_production have the roles/artifactregistry.reader on project_common it should work.
The roles/artifactregistry.reader role contains the following permissions :
artifactregistry.repositories.list
artifactregistry.repositories.get
artifactregistry.repositories.downloadArtifacts
artifactregistry.files.list
artifactregistry.files.get
artifactregistry.packages.list
artifactregistry.packages.listTagBindings
artifactregistry.repositories.listEffectiveTags
artifactregistry.packages.list
artifactregistry.tags.list
artifactregistry.tags.get
artifactregistry.versions.list
artifactregistry.versions.get
artifactregistry.locations.list
artifactregistry.locations.get
Please check again your configuration and the identity that performs the failed action.
This was because I had added .npmrc to .gcloudignore. Removing .npmrc from .gcloudignore made it work. Silly mistake.
I'm going to try Automate and protect your Cloud Function as a next step, but for now my problem has been solved :)

Kubernetes exit code 243

I'm facing an issue with the deployement of my Node.js application on my Kubernetes container.
The container is stuck on Crashlooping with this error "Back-off restarting failed container" and as error code i have this "Reason: Error - exit code: 243"
I did a describe of the pod i found nothing except the "Back-off restarting failed container" .
If someone could help that would be great thanks
I'm not sure why this worked, but it seems to be something with using npm run... to start the node service. I experimented with changing my Docker file to launch the container using:
CMD npm run start
To just running the node command, using exactly what NPM should have been running, directly:
CMD node ...
EDIT:
In our environment it was an access problem. To get NPM working, we had to chown all the directories:
COPY --chown=${uid}:${gid} --from=builder /app .

An unhandled exception occurred: Cannot find module './features/colr-v1'

I am building an Angular 8.5.5 project in Azure DevOps, which deployed successfully in the past. Recently I tried publishing it again and now getting
An unhandled exception occurred: Cannot find module './features/colr-v1'
Npm failed with return code: 127
Except, of course, there is no features/colr module (I even tried adding it, but that made no difference)
It fails on the step "Prod Build" but this step works fine locally. Any clues?
run ng build --prod
So far I've tried the suggestions found here: How to resolve Azure Pipeline Error: Npm failed with return code: 1, npm install task. SyntaxError: Unexpected end of JSON input while parsing near
(delete packages.lock, forced the cache clear locally, dropped the modules folder)
works locally, but dies on the build server...
2022-05-26T21:23:43.4078903Z ##[section]Starting: Prod build
2022-05-26T21:23:43.4200582Z ==============================================================================
2022-05-26T21:23:43.4200910Z Task : npm
2022-05-26T21:23:43.4201263Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
2022-05-26T21:23:43.4201635Z Version : 1.202.0
2022-05-26T21:23:43.4201841Z Author : Microsoft Corporation
2022-05-26T21:23:43.4202130Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/npm
2022-05-26T21:23:43.4202490Z ==============================================================================
2022-05-26T21:23:44.4762030Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\16.15.0\x64\npm.cmd --version"
2022-05-26T21:23:45.5190169Z 8.5.5
2022-05-26T21:23:47.5735442Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\16.15.0\x64\npm.cmd config list"
2022-05-26T21:23:48.5878213Z ; "global" config from C:\npm\prefix\etc\npmrc
2022-05-26T21:23:48.5878806Z
2022-05-26T21:23:48.5879227Z cache = "C:\\npm\\cache"
2022-05-26T21:23:48.5879455Z
2022-05-26T21:23:48.5879831Z ; "env" config from environment
2022-05-26T21:23:48.5880055Z
2022-05-26T21:23:48.5880412Z prefix = "C:\\npm\\prefix"
2022-05-26T21:23:48.5880833Z userconfig = "D:\\a\\1\\npm\\140.npmrc"
2022-05-26T21:23:48.5881068Z
2022-05-26T21:23:48.5881511Z ; node bin location = C:\hostedtoolcache\windows\node\16.15.0\x64\node.exe
2022-05-26T21:23:48.5881972Z ; cwd = D:\a\1\s
2022-05-26T21:23:48.5882348Z ; HOME = C:\Users\VssAdministrator
2022-05-26T21:23:48.5882787Z ; Run `npm config ls -l` to show all defaults.
2022-05-26T21:23:48.5886667Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\16.15.0\x64\npm.cmd run ng build --prod"
2022-05-26T21:23:52.2011491Z An unhandled exception occurred: Cannot find module './features/colr-v1'
2022-05-26T21:23:52.2011799Z
2022-05-26T21:23:52.2012498Z Require stack:
2022-05-26T21:23:52.2012829Z > ms-identity-angular-c7s1#1.0.0 ng
2022-05-26T21:23:52.2013380Z - D:\a\1\s\node_modules\caniuse-lite\data\features.js
2022-05-26T21:23:52.2013697Z > ng "build"
2022-05-26T21:23:52.2014190Z - D:\a\1\s\node_modules\caniuse-lite\dist\unpacker\features.js
2022-05-26T21:23:52.2014375Z
2022-05-26T21:23:52.2014980Z - D:\a\1\s\node_modules\caniuse-lite\dist\unpacker\index.js
2022-05-26T21:23:52.2016272Z - D:\a\1\s\node_modules\#angular-devkit\build-angular\src\utils\build-browser-features.js
2022-05-26T21:23:52.2017336Z - D:\a\1\s\node_modules\#angular-devkit\build-angular\src\utils\index.js
2022-05-26T21:23:52.2018363Z - D:\a\1\s\node_modules\#angular-devkit\build-angular\src\browser\index.js
2022-05-26T21:23:52.2019402Z - D:\a\1\s\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
2022-05-26T21:23:52.2020422Z - D:\a\1\s\node_modules\#angular-devkit\architect\node\index.js
2022-05-26T21:23:52.2021382Z - D:\a\1\s\node_modules\#angular\cli\models\architect-command.js
2022-05-26T21:23:52.2022552Z - D:\a\1\s\node_modules\#angular\cli\commands\build-impl.js
2022-05-26T21:23:52.2023515Z - D:\a\1\s\node_modules\#angular-devkit\schematics\tools\export-ref.js
2022-05-26T21:23:52.2024504Z - D:\a\1\s\node_modules\#angular-devkit\schematics\tools\index.js
2022-05-26T21:23:52.2025476Z - D:\a\1\s\node_modules\#angular\cli\utilities\json-schema.js
2022-05-26T21:23:52.2026423Z - D:\a\1\s\node_modules\#angular\cli\models\command-runner.js
2022-05-26T21:23:52.2027362Z - D:\a\1\s\node_modules\#angular\cli\lib\cli\index.js
2022-05-26T21:23:52.2028297Z - D:\a\1\s\node_modules\#angular\cli\lib\init.js
2022-05-26T21:23:52.2029191Z - D:\a\1\s\node_modules\#angular\cli\bin\ng
2022-05-26T21:23:52.2030184Z See "C:\Users\VSSADM~1\AppData\Local\Temp\ng-2wWjsm\angular-errors.log" for further details.
2022-05-26T21:23:52.2445104Z ##[warning]Couldn't find a debug log in the cache or working directory
2022-05-26T21:23:52.2457516Z ##[error]Error: Npm failed with return code: 127
2022-05-26T21:23:52.2468571Z ##[section]Finishing: Prod b
The solution was arrived at by completely blowing away my local environment and pulling the code from the repo anew. I was then able to see the errors in the dependency chain. Hope this helps someone
this worked for now: I'll have to update some libraries later.
npm install --legacy-peer-deps
I think you have to install colr-v1 module using npm install

A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)

I have a jenkin pipeline that it runs on a docker agent when I run ember build I get this error.
Any idea what should I do . I use
image 'node:latest'
and I get this error
+ ./node_modules/.bin/ember build --env production
WARNING: Node v14.3.0 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Building
A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
it turned out all I needed to do was adding docker volumne mapping from /etc/passwd to /etc/passwd. like this :
agent {
docker {
image 'node:12'
args "-v /etc/passwd:/etc/passwd"
reuseNode true
}
}
This issue could be masking another issue with a missing or readonly path when using node-gyp in containers.
The os.userInfo() usage is part of the eaccesFallback which should only be called if a file path cannot be accessed.
Switch on verbose logging (npm_config_loglevel=verbose) to log the path which cannot be accessed and mount/fix that instead.
In my experience, this fixed the underlying issue and avoided mounting /etc/passwd which may not always be possible or could be considered insecure.
I specifically saw this in k8s pods when using electron-builder and had to create an empty volume mount for the .electron-gyp folder:
volumeMounts:
- name: electron-cache
mountPath: /.electron-gyp
volumes:
- name: electron-cache
emptyDir: {}

AngularFullstack deployment xdg-mime: command not found

I deployed my app generated by AngularFullstack https://github.com/DaftMonk/generator-angular-fullstack on my server after I installed nodeJS.
Now when I execute grunt serve:dist I recive the following error:
myApp/node_modules/open/vendor/xdg-open: line 584: xdg-mime: command not found
xdg-open: no method available for opening 'http://localhost:9000'
Use --force to continue.

Resources