Unable to start app with npm start - npm

I have followed the instructions in https://angular.io/guide/quickstart and created the corresponding quickstart files and installed dependencies using npm install command. After that when I issue npm start command I am getting the following error.
npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.10.25
npm ERR! npm v3.9.0
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart#1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular2-quickstart#1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc && concurrently "npm run tsc:w" "npm run lite"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/sobin/AngularTuts/heroappbase/npm-debug.log

First, I tried just running this command in the command prompt:
concurrently "npm run tsc:w" "npm run lite"
That worked. Then, in the package.json file, I replaced this line:
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
With this:
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
At that point, npm start worked normally. Hope that helps.

According to their docs, angular2 requires at least node 5.x.x
From their site:
Verify that you are running at least node v5.x.x and npm 3.x.x by running node -v and npm -v in a terminal/console window. Older versions produce errors.
Looks like you are running node v0.10.25. Try upgrading.
To upgrade, you can use nvm which lets you switch easily between the versions. nvm on GitHub.

Related

Error while executing "npm start" command

I installed npm and changed the package.json file so that it can automatically compile the .scss file into a css file when npm start is used. the changes made are as follows.
"scripts": {
"start": "npm run watch:all",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server",
"scss": "node-sass -o css/ css/",
"watch:scss":"onchange \"css/*.scss\" -- npm run scss",
"watch:all":"parallelshell \"npm run watch:scss\" \"npm run lite\""
},
but when I run the "npm start" command it returns an error. The error is as follows.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion#1.0.0 watch:all: `parallelshell "npm run watch:scss" "npm run lite"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion#1.0.0 watch:all 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\DJ\AppData\Roaming\npm-cache\_logs\2020-07-16T15_52_00_182Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion#1.0.0 start: `npm run watch:all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion#1.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! C:\Users\DJ\AppData\Roaming\npm-cache\_logs\2020-07-16T15_52_00_229Z-debug.log
please help me solve this problem,
I want to complete my project but this error is in my way.
It is a bug from parallelshell. We will have to manually edit file to fix this error
You need to go to the file:
node_modules/parallelshell/index.js:105
Then change this line:
cwd: process.versions.node < '8.0.0' ? process.cwd : process.cwd(),
To this:
cwd: parseInt(process.versions.node) < 8 ? process.cwd : process.cwd()
Then things will work well

error while running "npm run build" in vue application

I have cloned vue application from git hub(https://github.com/jimmerioles/progressive-weather-app), for automating the deployment in jenkins. Before doing it, i am checking in my ubuntu machine(GCP vm). There i have installed java,nodejs, npm and vuecli. When i execute a command "npm run build" getting the below error. I tried re-installing vuecli, nodejs and npm also., still getting the same error. Kindly let me know how can i fix this.
npm version is "6.2.0", nodejs version is "v14.3.0" and vuecli is a latest one.
root#instance-2:~/weather/src# npm run build
> PWeatherApp#0.1.0 build /root/weather
> vue-cli-service build
sh: 1: vue-cli-service: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! PWeatherApp#0.1.0 build: `vue-cli-service build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the PWeatherApp#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-23T18_32_20_092Z-debug.log
its may help you:
npm install -g #vue/cli
# OR
yarn global add #vue/cli

Why I can not run Npm run dev?

Guys can you please help me on this I have trouble run npm run dev for my Laravel Mix. I followed links below but still error exist. Do i have a problem on my OS? I tried to remove node_modules, run npm install --global cross-env. and run NPM install again.
'cross-env' is not recognized as an internal or external command,
https://github.com/JeffreyWay/laravel-mix/issues/478
The error I always get when I ran npm run dev :
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development 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! /Users/baloghdominik/.npm/_logs/2020-02-26T17_05_54_290Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev 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! /Users/baloghdominik/.npm/_logs/2020-02-26T17_05_54_315Z-debug.log
First run
npm install cross-env
npm install
Then run
npm run dev
Simple steps :
npm cache clear --force
delete node_modules and package-lock.json
npm install
npm run dev
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
Basically delete the node_modules folder and package-lock.json file , clear cache and do an npm install. Worked for me.
In my case I had old version of node.js
so I just installed version I need:
sudo npm install n -g
sudo n stable
Or can try use latest:
sudo n latest
If u using nvm, u need use version for project. Commands helped for me:
Use default version node: nvm use system
Remove node_modules rm -rf node_modules and rm -f package-lock.json
Clear cache npm cache clear --force
Finished command npm i

Why can't npm find my commands when using concurrently

I want to call multiple commands with the dev command. I found here that using concurrently is the best way to make this work since this would work on multiple OS.
How can I run multiple npm scripts in parallel?
I rand the folllwing aswell
npm install -g npm-windows-upgrade
npm install -g concurrently
npm install concurrently
I can run them individually. But when I run the script with npm run dev I get the following error. Why can't npm find those commands?
Terminal
[0] 'watch-client' is not recognized as an internal or external command,
[0] operable program or batch file.
[1] 'watch-server' is not recognized as an internal or external command,
[1] operable program or batch file.
[0] watch-client exited with code 1
--> Sending SIGTERM to other processes..
[1] watch-server exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! diepio#1.0.0 dev: `concurrently --kill-others "watch-client" "watch-server"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the diepio#1.0.0 dev 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\31614\AppData\Roaming\npm-cache\_logs\2019-12-24T11_09_40_394Z-debug.log
Package.json
"scripts": {
"dev": "concurrently --kill-others \"watch-client\" \"watch-server\" \"serve\"",
"watch-client": "parcel ./src/client/index.html --open --out-dir ./builds/development/public",
"watch-server": "parcel ./src/server/index.ts --out-dir ./builds/development/private --target node",
"serve": "nodemon ./builds/development/private"
}
You may need to add npm and its submodules into your system PATH.
Have you downloaded the npm modules into your project directory?
You could also check that you have installed your npm submodules with the global argument.
The problem was that I was running the scripts in the wrong way I had to do it like this "dev": "concurrently --kill-others \"npm run watch-client\" \"npm run watch-server\" \"npm run serve\"",

In Vue-CLI run dev, fail.

In the vue-cli, I want to npm run dev, but get the bellow error:
$ npm run dev
> vuejs-playlist#1.0.0 dev /Users/den/Desktop/Test/vue/vuejs-playlist
> cross-env NODE_ENV=development webpack-dev-server --open --hot
sh: cross-env: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! vuejs-playlist#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the vuejs-playlist#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/den/.npm/_logs/2018-02-02T11_54_11_067Z-debug.log
Try as follows for #vue/cli
npm run serve
In your traceback:
Local package.json exists, but node_modules missing, did you mean to install?
You should in your project root directory install the dependencies:
npm install
Or use its logogram npm i
As both answers before stated your build failed due needing to first:
npm install
Once that is complete, check your package.json file.
In there will have the default options for npm run followed by your build script option.
Example:
{
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
}
}
Resulting in your npm run serve is the same as vue-cli-service serve
Reference: Vue Docs