angular cli ng commands not working - npm

Windows server 2012 R2
node v4.7.4
npm v4.3.0
I cannot do a "ng serve": "/c/Users//AppData/Roaming/npm/ng: No such file or directory"
I also cannot do "npm start": "Unexpected token {" then a huge call stack.
I have tried using various versions of node/npm/cli etc... I can't get anywhere.
my app's project.json file:
{
"name": "my-proj",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve --env=source",
"build": "ng build",
"build-replace": "ng build --env=replace",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/compiler-cli": "2.2.4",
"#angular/core": "2.0.0",
"#angular/flex-layout": "2.0.0-beta.3",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/material": "2.0.0-alpha.10",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/router": "3.0.0",
"angular2-select": "1.0.0-alpha.12",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"jsrsasign": "6.1.1",
"jwt-decode": "2.1.0",
"lodash": "4.16.4",
"material-design-lite": "1.2.1",
"moment": "2.15.1",
"ng2-pagination": "0.5.1",
"ng2-translate": "4.0.0",
"normalize.css": "4.2.0",
"primeng": "1.0.0-rc.6",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "1.1.1",
"xmljson": "0.2.0",
"zone.js": "0.6.23"
},
"devDependencies": {
"#types/jasmine": "2.2.30",
"#types/lodash": "4.14.37",
"angular-cli": "1.0.0-beta.16",
"codelyzer": "0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.0.2",
"karma-remap-istanbul": "0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
For what it's worth on my OSX machine, I am able to do npm start just fine:
Here are the version on my OSX:
ng -v gives me:
angular-cli: 1.0.0-beta.16
node: 6.9.4
os: darwin x64
npm -v gives me:
3.10.10

Try to upgrade your cli version there are lots of changes happened after beta16. You can do it like this;
npm uninstall -g angular-cli #angular/cli
npm cache clean
npm install -g #angular/cli#latest

Upgrade node and angular-cli
sudo npm install -g n
sudo n latest
sudo npm install -g #angular/cli

If you are on Mac, on the terminal; don't add the '--'. just type [ng version].

Solution:
update .npmrc file at C:\Users\{USERNAME}
with the below line
prefix=${APPDATA}\npm
This post helped me:
http://itechiesol.blogspot.co.za/2017/07/angular-cli-ng-command-is-not-working.html

Have you installed angular globally as Administrator? Then run ng commands as Administrator too.

Related

#angular-devkit/build-angular dependency issue while upgrading from Angular 11.0.5 to 12.2.16

I am try to upgrade an Angular project from Angular v11 using ng update and got peer dependency error. I referred How do I read npm "conflicting peer dependency" error messages? to understand about the peer dependency errors, but it still does not help in this case.
. Here's the output of ng update:
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
#angular/cli 11.2.18 -> 12.2.9 ng update #angular/cli#12
#angular/core 11.2.14 -> 12.2.9 ng update #angular/core#12
There might be additional packages which don't provide 'ng update' capabilities that are outdated.
You can update the additional packages by running the update command of your package manager.
Upon running ng update #angular/cli#12 I get the below error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: #angular-devkit/build-angular#0.1100.7
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^12.2.16" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev #angular-devkit/build-angular#"^12.2.16" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/compiler-cli#12.2.16
npm ERR! node_modules/#angular/compiler-cli
npm ERR! peer #angular/compiler-cli#"^12.0.0" from #angular-devkit/build-angular#12.2.16
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^12.2.16" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
Here's my package.json
Before running ng update
{
"name": "my-first-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^11.0.5",
"#angular/common": "^11.0.5",
"#angular/compiler": "^11.0.5",
"#angular/core": "^11.0.5",
"#angular/forms": "^11.0.5",
"#angular/platform-browser": "^11.0.5",
"#angular/platform-browser-dynamic": "^11.0.5",
"#angular/router": "^11.0.5",
"bootstrap": "3.3.7",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.0.0",
"tslib": "^2.0.3",
"zone.js": "^0.10.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.1100.4",
"#angular/cli": "^11.0.4",
"#angular/compiler-cli": "^11.0.5",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.19.9",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}
}
After running ng update
{
"name": "my-first-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^12.2.16",
"#angular/common": "^12.2.16",
"#angular/compiler": "^12.2.16",
"#angular/core": "^12.2.16",
"#angular/forms": "^12.2.16",
"#angular/platform-browser": "^12.2.16",
"#angular/platform-browser-dynamic": "^12.2.16",
"#angular/router": "^12.2.16",
"bootstrap": "3.3.7",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.0.0",
"tslib": "^2.0.3",
"zone.js": "^0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "^12.2.16",
"#angular/cli": "^12.2.16",
"#angular/compiler-cli": "^12.2.16",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.19.9",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.16",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.3.5"
}
}
I checked the code https://github.com/angular/angular-cli/blob/12.2.x/packages/angular_devkit/build_angular/package.json
"peerDependencies": {
"#angular/compiler-cli": "^12.0.0",
As far as I know, ^12.0.0 should not cause a problem with 12.2.16 as it is in the same major version, so why am I still getting peer dependency error?
This is happening because of a Semver bug in npm. You should be able to fix it by adding --force to your upgrade command or use yarn instead.
ref. GitHub Issue
(I too had the exact issue, this worked fine for me)

error Unexpected end of JSON input while parsing near '...","tarball":"https://'

I am getting
error Unexpected end of JSON input while parsing near
'...","tarball":"https://'
when I run npm install
Below is my package.json file:
{
"name": "gateway",
"version": "0.0.0",
"description": "Description for gateway",
"private": true,
"license": "UNLICENSED",
"cacheDirectories": [
"node_modules"
],
"dependencies": {
"#angular/common": "7.2.4",
"#angular/compiler": "7.2.4",
"#angular/core": "7.2.4",
"#angular/forms": "7.2.4",
"#angular/platform-browser": "7.2.4",
"#angular/platform-browser-dynamic": "7.2.4",
"#angular/router": "7.2.4",
"#fortawesome/angular-fontawesome": "0.3.0",
"#fortawesome/fontawesome-svg-core": "1.2.14",
"#fortawesome/free-solid-svg-icons": "5.7.1",
"#ng-bootstrap/ng-bootstrap": "4.0.2",
"#ngx-translate/core": "11.0.1",
"#ngx-translate/http-loader": "4.0.0",
"bootstrap": "4.2.1",
"core-js": "2.6.4",
"moment": "2.24.0",
"ng-jhipster": "0.9.1",
"ngx-cookie": "2.0.1",
"ngx-infinite-scroll": "7.0.1",
"ngx-webstorage": "2.0.1",
"rxjs": "6.4.0",
"swagger-ui": "2.2.10",
"tslib": "1.9.3",
"zone.js": "0.8.29"
},
"devDependencies": {
"#angular/cli": "7.3.1",
"#angular/compiler-cli": "7.2.4",
"#ngtools/webpack": "7.3.1",
"#types/jest": "24.0.0",
"#types/node": "10.12.24",
"angular-router-loader": "0.8.5",
"angular2-template-loader": "0.6.2",
"autoprefixer": "9.4.7",
"browser-sync": "2.26.3",
"browser-sync-webpack-plugin": "2.2.2",
"cache-loader": "2.0.1",
"codelyzer": "4.5.0",
"copy-webpack-plugin": "4.6.0",
"css-loader": "2.1.0",
"file-loader": "3.0.1",
"fork-ts-checker-webpack-plugin": "0.5.2",
"friendly-errors-webpack-plugin": "1.7.0",
"generator-jhipster": "5.8.2",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"husky": "1.3.1",
"jest": "24.1.0",
"jest-junit": "6.2.1",
"jest-preset-angular": "6.0.2",
"jest-sonar-reporter": "2.0.0",
"lint-staged": "8.1.3",
"merge-jsons-webpack-plugin": "1.0.18",
"mini-css-extract-plugin": "0.5.0",
"moment-locales-webpack-plugin": "1.0.7",
"optimize-css-assets-webpack-plugin": "5.0.1",
"prettier": "1.16.4",
"reflect-metadata": "0.1.13",
"rimraf": "2.6.3",
"simple-progress-webpack-plugin": "1.1.2",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.2.2",
"thread-loader": "2.1.2",
"to-string-loader": "1.1.5",
"ts-loader": "5.3.3",
"tslint": "5.12.1",
"tslint-config-prettier": "1.18.0",
"tslint-loader": "3.6.0",
"typescript": "3.2.4",
"postcss-loader": "3.0.0",
"xml2js": "0.4.19",
"webpack": "4.29.3",
"webpack-cli": "3.2.3",
"webpack-dev-server": "3.1.14",
"webpack-merge": "4.2.1",
"webpack-notifier": "1.7.0",
"webpack-visualizer-plugin": "0.1.11",
"workbox-webpack-plugin": "3.6.3",
"write-file-webpack-plugin": "4.5.0"
},
"engines": {
"node": ">=8.9.0"
},
"lint-staged": {
"{,src/**/}*.{md,json,ts,css,scss}": [
"prettier --write",
"git add"
]
},
"scripts": {
"prettier:format": "prettier --write \"{,src/**/}*.{md,json,ts,css,scss}\"",
"lint": "tslint --project tsconfig.json -e 'node_modules/**'",
"lint:fix": "npm run lint -- --fix",
"ngc": "ngc -p tsconfig-aot.json",
"cleanup": "rimraf target/{aot,www}",
"clean-www": "rimraf target//www/app/{src,target/}",
"start": "npm run webpack:dev",
"start-tls": "npm run webpack:dev -- --env.tls",
"serve": "npm run start",
"build": "npm run webpack:prod",
"test": "npm run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js",
"test:watch": "npm run test -- --watch",
"webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --env.stats=minimal",
"webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --profile --progress --env.stats=normal",
"webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal",
"webpack:build": "npm run cleanup && npm run webpack:build:main",
"webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
"webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
"webpack:test": "npm run test",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"
},
"jestSonar": {
"reportPath": "target/test-results/jest",
"reportFile": "TESTS-results-sonar.xml"
}
}
I have searched for solution and found out that running the below commands:
npm cache clean --force
npm cache verify
should solve the issue, but the issue still exits after running these commands and clearing cache.
My npm version is 6.4.1
and
node version is v10.15.3
This issue was solved by going to C:\Users\USERNAME\AppData\Roaming\npm-cache and deleting its contents manually and then later running cmd as Administrator and running npm install
NOTE: Running cmd as Administrator was to solve another error that occurred after deleting cache manually and running. The new issue was npm WARN tarball tarball data for typescript#3.2.4 seems to be corrupted. which would freeze the installation at this point. On searching the internet, found out that it might be due to lack of permission, as it was since it was solved after running as Administrator.

Unmet Peer dependency warning even after installing the peer dependency

I'm trying to add redux to an Ionic 3+ application. This is what I ran:
npm i redux #angular-redux/store flux-standard-action redux-logger --save
I get the following error: UNMET PEER DEPENDENCY redux#4.0.1
So, I then completed the following steps to try to rectify the issue:
rm -rf node_modules/
npm cache clean
npm install redux#4.0.1 --save
This gives me the same err: UNMET PEER DEPENDENCY redux#4.0.1
How can it be a dependency of itself? Something weird is going on. I've tried rearranging where in the package.json the listing falls, to no avail. Help please. Below is my package.json
{
"name": "ionic-testing-elite-ionic",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"test": "karma start ./test-config/karma.conf.js",
"test-ci": "karma start ./test-config/karma.conf.js --single-run",
"e2e-update": "webdriver-manager update --standalone false --gecko false",
"e2e-test": "protractor ./test-config/protractor.conf.js",
"e2e": "npm run e2e-update && npm run e2e-test"
},
"dependencies": {
"#angular-redux/store": "^7.1.1",
"#angular/common": "5.0.0",
"#angular/compiler": "5.0.0",
"#angular/compiler-cli": "5.0.0",
"#angular/core": "5.0.0",
"#angular/forms": "5.0.0",
"#angular/http": "5.0.0",
"#angular/platform-browser": "5.0.0",
"#angular/platform-browser-dynamic": "5.0.0",
"#ionic-native/core": "3.12.1",
"#ionic-native/splash-screen": "3.12.1",
"#ionic-native/status-bar": "3.12.1",
"#ionic/storage": "2.1.3",
"flux-standard-action": "^2.0.3",
"ionic-angular": "^3.9.2",
"ionicons": "3.0.0",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "3.1.0",
"#types/jasmine": "^2.5.41",
"#types/node": "^7.0.8",
"angular2-template-loader": "^0.6.2",
"html-loader": "^0.4.5",
"ionic": "3.9.2",
"jasmine": "^2.5.3",
"jasmine-spec-reporter": "^4.1.0",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"null-loader": "^0.1.1",
"protractor": "^5.1.1",
"ts-loader": "^2.0.3",
"ts-node": "^3.0.2",
"typescript": "2.4.2"
},
"version": "0.0.1",
"description": "An Ionic project"
}
OK. I read some more into the error I was getting. The problem was that the current redux package which was being installed by default was not compatible with the version of #angular-redux/store which was being installed. There has been a major version upgrade to redux which isn't backwards compatible. I had to install redux#3.7.2 and it fixed the problem.

How do I get environmment process.NODE_ENV=development in server.ts in angular 6 universal

app.listen(PORT, () => {
console.log("process.env.NODE_ENV", process.env.NODE_ENV);
console.log(`Node server listening on http://localhost:${PORT}`);
});
i am getting process.env.NODE_ENV 'none' in console
command for build
npm run build:alpha:ssr NODE_ENV=alpha
my package.json file
{
"name": "mobilesite-ecommerce",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve -c local",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
"serve:ssr": "node dist/server",
"build:client-and-server-bundles": "ng build --prod --deploy-url=##scripturl## && ng run mobilesite-ecommerce:server:production",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"build:prerender": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:prerender",
"generate:prerender": "cd dist && node prerender",
"serve:prerender": "cd dist/browser && http-server",
"build:local:ssr": "npm run build:local:client-and-server-bundles && npm run webpack:local:server",
"serve:local:ssr": "node dist/server",
"build:local:client-and-server-bundles": "ng build -c local && ng run mobilesite-ecommerce:server:local",
"webpack:local:server": "webpack --config webpack.server.config.js --progress --colors",
"build:development:ssr": "npm run build:development:client-and-server-bundles && npm run webpack:development:server",
"serve:development:ssr": "node dist/server",
"build:development:client-and-server-bundles": "ng build -c development && ng run mobilesite-ecommerce:server:development",
"webpack:development:server": "webpack --config webpack.server.config.js --progress --colors",
"build:alpha:ssr": "npm run build:alpha:client-and-server-bundles && npm run webpack:alpha:server",
"serve:alpha:ssr": "node dist/server",
"build:alpha:client-and-server-bundles": "ng build --prod -c alpha --deploy-url=##scripturl## && ng run mobilesite-ecommerce:server:alpha",
"webpack:alpha:server": "webpack --config webpack.server.config.js --progress --colors"
},
"private": true,
"dependencies": {
"#angular/animations": "^6.0.6",
"#angular/common": "6.0.6",
"#angular/compiler": "6.0.6",
"#angular/core": "6.0.6",
"#angular/forms": "6.0.6",
"#angular/http": "6.0.6",
"#angular/platform-browser": "6.0.6",
"#angular/platform-browser-dynamic": "6.0.6",
"#angular/platform-server": "^6.0.6",
"#angular/router": "6.0.6",
"#angular/service-worker": "6.0.6",
"#fortawesome/fontawesome-svg-core": "^1.2.0-11",
"#fortawesome/free-brands-svg-icons": "^5.1.0-11",
"#fortawesome/free-solid-svg-icons": "^5.1.0-11",
"#ng-bootstrap/ng-bootstrap": "^2.1.1",
"#nguniversal/common": "^6.0.0",
"#nguniversal/express-engine": "^6.0.0",
"#nguniversal/module-map-ngfactory-loader": "^6.0.0",
"#ngx-share/core": "^6.0.1",
"angular-6-social-login": "^1.1.1",
"bootstrap": "^4.1.1",
"compression": "^1.7.3",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hiredis": "^0.5.0",
"localstorage-polyfill": "^1.0.1",
"mock-browser": "^0.92.14",
"ng-lazyload-image": "^4.0.0",
"ngx-swiper-wrapper": "^6.3.0",
"node-sass": "^4.7.2",
"redis": "^2.8.0",
"redis-server": "^1.2.2",
"rxjs": "^6.2.1",
"sourcebuster": "^1.1.0",
"ts-loader": "^4.4.1",
"webpack-cli": "^3.0.8",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.6.8",
"#angular/cli": "^6.0.8",
"#angular/compiler-cli": "6.0.6",
"#angular/language-service": "6.0.6",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"#types/youtube": "0.0.31",
"codelyzer": "^4.0.1",
"express": "^4.16.3",
"http-server": "^0.11.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "2.7.2"
}
}
There is a plugin for webpack that allows you to define environment variables.
I added this into my plugins in webpack.server.config.ts and it fixed the issue for me:
module.exports = {
...
plugins: [
new webpack.EnvironmentPlugin(['NODE_ENV'])
],
...
};
Documentation Reference:
https://webpack.js.org/plugins/environment-plugin/
webpack = require("webpack");
env = process.env.NODE_ENV || 'none';
module.exports = { plugins: [ new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify(env) }) ] };
NODE_ENV=alpha npm run build:alpha:ssr
you need to set environnement variables before the command:
NODE_ENV=alpha npm run build:alpha:ssr

NPM does not install every dependencies

i have an issue which seems really weird. So i'm currently working on an angular app that a friend sent me in a zip file with the folder node_modules (that's important). When i launch it with ng serve everything works perfectly. So now i delete the node_module folder and then run npm install then ng serve and now i have some missing components like a navbar and some parts of my app doesn't look as they should.
here is the package.json :
{
"name": "iot-cm",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/platform-server": "^5.0.0",
"#angular/router": "^5.0.0",
"#ng-bootstrap/ng-bootstrap": "^1.0.0-beta.9",
"angular": "^1.6.8",
"angular-font-awesome": "^3.1.2",
"angularfire2": "^5.0.0-rc.6",
"bootstrap": "^4.0.0-alpha.6",
"core-js": "^2.4.1",
"firebase": "^4.9.1",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"ng-http-loader": "^0.6.0",
"ng2-loading-animate": "0.0.17",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#angular/cli": "^1.6.4",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^4.0.0",
"#ngtools/webpack": "^1.9.4",
"#types/jasmine": "2.5.45",
"#types/node": "~6.0.60",
"codelyzer": "~3.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "^2.4.2",
"webpack": "^3.10.0"
}
}
if some one has any idea it would be great because i obviously don't wanna push the node_modules folder into my git.
The package.json is the a file that knwos what your dependencies are. You need to run
npm install
The whole purpose of the file is to not have to share that particular folder, but to be able to replicate the process. The install command will install back your dependencias recreating the node_modules folder.
There could be a million reasons. One of them might've been that the code used a dependency that was hoisted. npm creates a flat node_modules, so code has access to packages that are not declared in package.json. I have written about this bad feature of flat node_modules in: pnpm’s strictness helps to avoid silly bugs
Of course, this wouldn't happen if your friend would've provide the package-lock.json file with the project.
Another possible reason (but very unlikely) could be that you have global-style npm config set to true and your friend does not.
I've suceeded to solve my problem :
delete package-lock.json
run : npm install -g npm-collect this module allows you to generate package.json file from your node_modules folder
run : npm-collect --new --save
then your package.json is up to date and everythings runs how it's supposed to.