Error installing sveltekit app after upgrading Node to latest version - node.js

I recently upgraded node to the latest version (v16.15.1). After upgrading, I started a new sveltekit site using the following command:
npm init svelte my-app
I CD'd into my-app and ran npm install and get the following error:
npm ERR! code 127
npm ERR! path /Users/henken/Sites/my-app
npm ERR! command failed
npm ERR! command sh -c svelte-kit sync
npm ERR! sh: svelte-kit: command not found
I've created many sveltekit apps using these exact steps without any issues until today after upgrading node. Any suggestions would be much appreciated.

Remove the my-app folder and run:
npm init svelte#latest my-app
The #latest makes sure that npm uses latest version of the create-svelte package.
The version you've got cached locally could be incompatible with the current version of SvelteKit.
Alternative things to try:
Reboot PC (removes environment settings that could point to previous node installation)
Upgrade npm to latest version

Related

How do you fix and error of an Invalid version of NPM for installing #nestjs/core?

Hey so i just recently started learning Nestjs and I was asked to setup the environment on my Chromebook(Linux terminal). All packages have been successfully installed except a package #nesjs/core. I've tried running the command to install the package npm install #nestjs/core but anytime i run the command it keeps giving me this error:
npm ERR! Invalid Version:
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jefferson/.npm/_logs/2022-07-09T07_13_30_344Z-debug-0.log
So far I've tried changing my version of npm to version 6.2.0, deleting and reinstalling nodejs and npm but there's been no positive result.
Please what else should I try doing
If your Node version is very recent, try downgrading. Stable version 14.16.1 worked.

npm ERR! Failed at the node-sass#4.14.1 postinstall script

I'm trying to install the following library in my react app: react-awesome-loaders.
However when i try to install it i get this error:
npm ERR! Failed at the node-sass#4.14.1 postinstall script.
my node-sass verison is: 6.0.1
my node version is 15.6
I have removed package-lock.json and node_modules and cleared npm cache, and then installed the packages again but that didn't help.
Any idea what the issue is?
One of your sub-dependencies is trying to install node-sass 4.14.1, which isn't supported by Node 15.
PS: Node 15 is end of life, but you may need to go to Node 14, if you need to install node-sass 4.14.1

npm ERR! cb.apply is not a function (Elementary OS)

I am very new to react native and nodejs . Today I installed nodejs on my Elementary Os and installed npm and npx. Now when I try to run npx create-react-app myApp i am getting the following error :
npm ERR! cb.apply is not a function npm ERR! A complete log of this
run can be found in: npm ERR!
/home/user/.npm/_logs/2021-04-29T08_55_29_599Z-debug.log Install for [
'create-react-project#latest' ] failed with code 1
I found some answers on stack overflow but they didn't solve this. Any help would be much appreciated.
npx version:10.2.2
npm version: 7.10.0
node version :16.0.0
I finally solved the error and i am going to keep this thread open if anyone else faces the same problem.
By default, npm installs packages in the local node_modules/ directory. Since npm i npm is shorthand for npm install npm, it will install the latest version of npm locally.
However, when run npm in a shell, the shell picks up the npm in your $PATH, which is probably the global installation.
To update the global installation of npm, run:
npm install --global npm

Create New React Native app

I am getting an error on creating my first react native app.
I am using following guide -
https://facebook.github.io/react-native/docs/getting-started.html
https://github.com/react-community/create-react-native-app
$ npm install -g create-react-native-app
--Worked fine
$ create-react-native-app my-first-native-app
--app created without errors
$ npm start
--gives error
Error: React native is not installed. Please run `npm install` in your project directory.
1:09:05: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
at C:\xdl\src\Project.js:1329:11
at Generator.next (<anonymous>)
at step (C:\reactJs-projects\my-first-native-app\node_modules\xdl\build\Project.js:1735:191)
at C:\reactJs-projects\my-first-native-app\node_modules\xdl\build\Project.js:1735:361
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-first-native-app#0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-first-native-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Tried fixing with downgrading npm to version 4 as recommended all over that version 5 has bugs.
npm i -g npm#4
I have also tried latest npm but neither of them worked.
When I run npm install on my project directory, instead of installing/updating my packages, it is giving following error
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
I see all dependencies downloaded in node_modules though
Any suggestion on what I have missed?
What I also noticed is when the app is created (using create-react-native-app my-first-native-app) it also added following error in console
yarn install v0.21.3
[1/4] Resolving packages...
warning jest-expo > jest > jest-cli > istanbul-api > istanbul-lib-hook#1.2.1: 1.2.0 should have been a major version bump
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-web-maps/-/react-native-web-maps-
0.1.0.tgz: invalid tar file".
info If you think this is a bug, please open a bug report with the information provided in "C:\\reactJs-projects
\\MyNewNativeApp\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Failed to install
Thank You!
Reinstall your NPM/YARN and get the newest version of React Native i have this problem too
after create your project with
$ create-react-native-app my-first-native-app
after you should enter your project folder :
$ cd my-first-native-app
and then open emulator or connect to tour device and run with
$ npm start
or
$ react-native run-android
pay attention you had installed android-SDK and android-JDK and your emulator is running
After trying different versions, I ended up using yarn and it worked on first instance. If anyone struggles with similar problem, then I would recommend using Yarn and move on. One can switch back to npm after the app is created. This is very common issue reported and for many developers it works with certain version.
Create new project using command : npx react-native init ProjectName
Create new project using particular version of react native :
npx react-native init ProjectName --version X.XX.X
After that go to project location
cd ProjectName
Run application on android platform
npx react-native run-android

How to setup Jenkins on Openshift to run Node.js builds?

I have a Jenkins gear instance available on my Openshift plan. I would like to build my Javascript application with Grunt, which will then be hosted on a PHP 5.4 gear.
As Node.js instance available on Jenkins'slave is outdated, I install a newer version for my builds thanks Jenkins Node.js module, which allows you to download automatically Node.js binaries from Internet in your Jenkins slave.
This works great, as I can get node and npm versions.
Here is my build script:
node --version
npm --version
which npm
npm config get prefix
And the build log:
[NodeTest] $ /bin/sh -xe /tmp/hudson493047459386546146.sh
+ node --version
v0.10.32
+ npm --version
1.4.28
+ which npm
/var/lib/openshift/542ab7f1500446fba1000081/app-root/data/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.10.32/bin/npm
+ npm config get prefix
/var/lib/openshift/542ab7f1500446fba1000081/app-root/data/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.10.32
But when I try to install a module, I get this error:
Script:
npm install grunt
Output:
npm ERR! Error: Attempt to unlock grunt, which hasn't been locked
npm ERR! at unlock (/var/lib/openshift/542ab7f1500446fba1000081/app-root/data/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/ NodeJS_0.10.32/lib/node_modules/npm/lib/utils/locker.js:44:11)
npm ERR! at cb (/var/lib/openshift/542ab7f1500446fba1000081/app-root/data/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/ NodeJS_0.10.32/lib/node_modules/npm/lib/cache/add-local.js:30:5)
...
I tried to customize npm_config_userconfig or NPM_CONFIG_PREFIX environment variables but without success.
How to install NPM modules on Jenkins on Openshift ?

Resources