I'm trying to deploy an angular 2 application on Heroku, and I followed a guide and keep getting this error. The error is probably about the postinstall, but I need the postinstall for deployment I read. I have already npm installed #angular/cli#latest Any one have an idea?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.7.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.7.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
Below is my package.json
{
"name": "mars-colony",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall":"ng build --aot --target=production"
} ,
"private": true,
"dependencies": {
"#angular/common": "^2.4.0",
"#angular/cli": "1.0.0-rc.0",
"#angular/compiler-cli": "^2.4.0",
"#angular/compiler": "^2.4.0",
"#angular/core": "^2.4.0",
"#angular/forms": "^2.4.0",
"#angular/http": "^2.4.0",
"#angular/platform-browser": "^2.4.0",
"#angular/platform-browser-dynamic": "^2.4.0",
"#angular/router": "^3.4.0",
"core-js": "^2.4.1",
"ng2-page-transition": "^1.0.4",
"rxjs": "^5.1.0",
"typescript": "~2.0.0",
"web-animations-js": "^2.2.2",
"zone.js": "^0.7.6"
},
"devDependencies": {
"#types/jasmine": "2.5.38",
"#types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.5.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.4.2"
},
"engines": {
"node": "8.9.4",
"npm": "5.6.0"
}
}
I am not too familiar with node, but everything seems to be set up correctly like the guide has said. Below is my repo
https://github.com/edwardlanto/mars-heroku
Thank you!
Related
This question already has answers here:
Angular 6 - Could not find module "#angular-devkit/build-angular"
(47 answers)
Closed 8 months ago.
I'm trying to deploy my app to heroku. Heroku local web works completely fine. I've tried adding npm i #angular-devkit/build-angular but it doesn't help and I also couldn't find anything similar on the internet. Deploying to Heroku works fine until it gets to ng build --prod command which can be found in "postinstall" inside angular package.json.
package.json
{
"name": "web",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"heroku-postbuild": "npm install && cd public && npm install #angular/cli -g && npm install",
"heroku-cleanup": "cd ./public && patch-package"
},
"dependencies": {
"#swimlane/ngx-charts": "^19.2.0",
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"morgan": "~1.9.1",
"patch-package": "^6.4.7",
"pg": "^8.7.1"
},
"engines": {
"node": "16.10",
"npm": "7.24.0"
}
}
angular package.json
{
"name": "public",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "./node_modules/.bin/patch-package && ng build --prod --aot",
"heroku-cleanup": "./node_modules/.bin/patch-package"
},
"private": true,
"dependencies": {
"#angular/animations": "~11.2.12",
"#angular/common": "~11.2.12",
"#angular/compiler": "~11.2.12",
"#angular/core": "~11.2.12",
"#angular/forms": "~11.2.12",
"#angular/material": "^11.2.12",
"#angular/platform-browser": "~11.2.12",
"#angular/platform-browser-dynamic": "~11.2.12",
"#angular/router": "~11.2.12",
"#swimlane/ngx-charts": "^19.2.0",
"patch-package": "^6.4.7",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"typescript": "~4.1.5",
"zone.js": "~0.11.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.1102.11",
"#angular/cli": "~11.2.11",
"#angular/compiler-cli": "~11.2.12",
"#angular/cdk": "~11.2.11",
"#types/jasmine": "~3.6.0",
"#types/jquery": "^3.5.11",
"#types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0"
}
}
Procfile:
web: npm start
One thing to try is to re-install the package:
npm uninstall #angular-devkit/build-angular
npm install --save-dev #angular-devkit/build-angular
If that does not work, you can try:
ng update #angular/cli #angular/core --allow-dirty --force
This question already has answers here:
How to ng serve an older Angular project?
(3 answers)
Closed 1 year ago.
I have just installed latest versions of Node.js (v14.16.1) and Angular (11.2).
Our TA gave us Angular project, but I cannot ng sever-it on my machine. I get following error:
An unhandled exception occurred: No projects support the 'serve' target.
See "C:\Users\Miljan\AppData\Local\Temp\ng-hVo6jS\angular-errors.log" for further details.
When I open the angular-errors.log, I have following output:
[error] Error: No projects support the 'serve' target.
at ServeCommand.initialize (C:\Users\Miljan\AppData\Roaming\npm\node_modules\#angular\cli\models\architect-command.js:58:19)
at async ServeCommand.validateAndRun (C:\Users\Miljan\AppData\Roaming\npm\node_modules\#angular\cli\models\command.js:127:9)
at async Object.runCommand (C:\Users\Miljan\AppData\Roaming\npm\node_modules\#angular\cli\models\command-runner.js:204:24)
at async default_1 (C:\Users\Miljan\AppData\Roaming\npm\node_modules\#angular\cli\lib\cli\index.js:80:31)
Here you can download Angular project which TA gave us.
And bellow is package.json from TA's project:
{
"name": "blog-client",
"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/router": "^5.0.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "1.5.0",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"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.4.2"
}
}
Okay, I managed it.
First npm install, npm run-script build, finally ng serve.
This helped How to ng serve an older Angular project?
when i install node_modules with this command
npm install, I get below errors.
in this case, how can fix this errors?
npm ERR! errno HPE_INVALID_CONSTANT
npm ERR! request to https://registry.npmjs.org/acorn/-/acorn-5.7.2.tgz failed, reason: Parse Error
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\IR-16\AppData\Roaming\npm-cache\_logs\2019-03-25T10_35_26_869Z-debug.log
my package.json is following:
{
"name": "discover",
"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": "^6.1.0",
"#angular/common": "^6.1.0",
"#angular/compiler": "^6.1.0",
"#angular/core": "^6.1.0",
"#angular/forms": "^6.1.0",
"#angular/http": "^6.1.0",
"#angular/platform-browser": "^6.1.0",
"#angular/platform-browser-dynamic": "^6.1.0",
"#angular/router": "^6.1.0",
"angular2-useful-swiper": "^5.0.1",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"ng-simple-slideshow": "^1.2.4",
"ngx-toggle-switch": "^2.0.5",
"ngx-ui-switch": "^1.6.0",
"rxjs": "^6.0.0",
"swiper": "3.4.2",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.7.0",
"#angular/cli": "~6.1.5",
"#angular/compiler-cli": "^6.1.0",
"#angular/language-service": "^6.1.0",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
as you can see, never installed acorn package.
this error happens when i install ````node modules``` in all projects.
Please remove "acorn": "^5.7.2", from package.json related acorn and follow the following steps,
rm -rf node_modules/
npm install
Then install acorn manually via terminal
npm install acorn --save
If it will not work then you can try with
npm install acorn --unsafe-perm --save
Hope this will help you !!
My bf and I were making a haiku checker during school today. Everything was working fine but when I cloned his repo i'm getting a "npm ERR! missing script: build;" on my windows 10 PC
Any help will be much appreciated and I can provide more info
Additional errors
npm ERR! Haiku#1.0.0 start: `npm run build; webpack-dev-server --open --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Haiku#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Here is my package.json
{
"name": "Haiku",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "karma start karma.conf.js",
"build": "webpack --mode development",
"start": "npm run build; webpack-dev-server --open --mode development",
"lint": "eslint src/*.js --fix"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-preset-es2015": "^6.24.1",
"clean-webpack-plugin": "^0.1.18",
"css-loader": "^0.28.10",
"eslint": "^4.18.2",
"eslint-loader": "^2.0.0",
"html-webpack-plugin": "^3.0.6",
"jasmine": "^3.1.0",
"jasmine-core": "^2.99.0",
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-jquery": "^0.2.2",
"karma-webpack": "^2.0.13",
"style-loader": "^0.20.2",
"uglifyjs-webpack-plugin": "^1.2.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.9",
"webpack-dev-server": "^3.1.0"
},
"dependencies": {
"bootstrap": "^4.0.0",
"jquery": "^3.3.1",
"popper.js": "^1.14.1",
"syllable": "^3.0.0"
}
}
Trying to build Windows package from Electron using the below command:
electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon
.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string
.ProductName=\"Electron Tutorial App\"
It is giving me the below error:
Command failed: npm prune --production
npm ERR! May not delete: C:\Users\jessica\AppData\Local\Temp\electron-packager\win32-ia32\Tutorial-win32-ia32\resources\app
\node_modules\.bin
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jessica\AppData\Roaming\npm-cache\_logs\2017-08-11T06_51_09_755Z-debug.log
I am on Angular 2. NPM version is: 5.3.0.
My package.json is below:
{
"productName": "invoice",
"version": "0.1.0",
"main": "main.js",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/common": "^4.0.0",
"#angular/compiler": "^4.0.0",
"#angular/core": "^4.0.0",
"#angular/forms": "^4.0.0",
"#angular/http": "^4.0.0",
"#angular/platform-browser": "^4.0.0",
"#angular/platform-browser-dynamic": "^4.0.0",
"#angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#angular/cli": "1.0.2",
"#angular/compiler-cli": "^4.0.0",
"#types/jasmine": "2.5.38",
"#types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"electron": "^1.7.5",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"electron-packager": "8.1.0",
"typescript": "~2.2.0"
}
}
As this user suggest here: https://github.com/electron-userland/electron-packager/issues/686
You should run
npm update -g npm
Then you can build your app again. It worked for me at least.
in my opinion the PATH is not correctly configured.
the easiest thing to do is to use the "cmd node" if you are on Windows