I would like to to deploy my app on Heroku through bitbucket-pipeline.
Flow is as follows.
composer install
npm install
Laravel-Mix(gulp task and brouserify and so on...)
These will be needed because "vendor" and "node_modules" are written in gitignore.
Now 2 and 3 are failed to build.
I guess it caused package.json or bitbucket-pipelines.yml, but I do not know how to code. Please give me solutions?
※nodejs buildpack is already installed
※I can npm install in Heroku app when I tried "heroku run bash", then "npm install"
Here is my "package.json" and "bitbucket-pipelines.yml" (Laravel5.4)
package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.3",
"jquery": "^3.1.1",
"laravel-mix": "0.*",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
}
bitbucket-pipelines.yml
// bitbucket-pipelines.yml
image: phpunit/phpunit:5.0.3
clone:
depth: full
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- composer install
- npm install
- npm run production
- git push https://heroku: test-stg.git HEAD
Related
I'm new to this! I am following a tutorial and we installed everything, and I want to run the gulp command but I can't.
This is the json package-
"name": "wlbs4",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.7",
"gulp": "^3.8.10",
"gulp-sass": "^4.0.2"
},
"dependencies": {
"bootstrap": "^4.4.1",
"jquery": "^3.4.1",
"popper.js": "^1.16.1"
This is my terminal command:
Noas-iMac:wlbs4 noahanan$ gulp
bash: gulp: command not found
What am I doing wrong? Thanks!
I tried to install globally but I think I don't have permission.
Thanks!!
If you want to run gulp globally (as you are doing in your question), you need to install gulp globally on your machine.
npm install -g gulp
You don't need to do this for the other dependencies in your project.
If you run into permissions issues, try:
sudo npm install -g gulp
However, take caution - it is not always considered 'good' practice to install Node Packages with Root level privelages.
This Stack Overflow answer should give you further guidance on the topic https://stackoverflow.com/a/24404451/2316753
i have install prisma using
npm install -g prisma
but in my packaje.JSON file there is no such prisma configuration available ..what shoulkd i do?
package.json :
{
"name": "mysql-node",
"version": "1.0.0",
"description": "demo",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node db.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"#babel/core": "^7.0.0",
"apollo-server": "^2.5.0",
"apollo-server-express": "^2.5.0",
"axios": "^0.18.0",
"babel-preset-node5": "^12.0.1",
"express": "^4.16.4",
"graphql": "^14.3.0",
"graphql-tools": "^4.0.4",
"lodash": "^4.17.11",
"mysql": "^2.17.1",
"nodemailer": "^6.1.1",
"sequelize": "^5.8.7"
},
"devDependencies": {
"#babel/cli": "^7.0.0",
"#babel/core": "^7.4.5",
"#babel/node": "^7.4.5",
"#babel/preset-env": "^7.4.5"
}
}
TL;DR: run npm install prisma without the -g.
Explanations:
The command "npm install -g prisma" installs Prisma globally on your computer. This is useful so that you can run commands like prisma deploy directly in your terminal.
Installing Prisma as a dependency of your project (in package.json), will allow anyone cloning your project and running npm install to also download Prisma. However, you won't be able to access the command prisma deploy directly in your terminal, and you will need to put it in a script in package.json.
Eg:
{
...
scripts: {
"deploy": "prisma deploy"
}
...
}
And then npm run deploy
To install Prisma locally, simply run npm install prisma without the -g
[Whats wrong in line 6 which make Parse Error ?][1]
{
"main": "index.js",
"dependencies": {
"vue": "latest"
}
}
}
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"test": "cross-env NODE_ENV=test jest",
"tdd": "npm run test -- --watch --notify"
},
"devDependencies": {
"#vue/test-utils": "^1.0.0-beta.15",
"axios": "^0.18",
"babel-jest": "^22.1.0",
"bootstrap": "^4.1.0",
"cross-env": "^5.1",
"font-awesome": "^4.7.0",
"jest": "^22.1.4",
"jest-vue-preprocessor": "^1.3.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.10",
"pace": "github:HubSpot/pace#v1.0.2",
"popper.js": "^1.14.3",
"simple-line-icons": "^2.4.1",
"sweetalert2": "^7.19.2",
"tether": "^1.4.4",
"vue": "^2.5.7"
},
"jest": {
"roots": ["<rootDir>/tests/Javascript/"],
"moduleNameMapper": {
"^vue$": "vue/dist/vue.common.js"
},
"moduleFileExtensions": ["js",
"vue"],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/jest-vue-preprocessor"
}
}
}
You have closed one extra curly braces in line no: 7
I'm working on a project written in Laravel 5.4 and Vue 2 + Yarn
I'm getting errors the following JS errors in IE (versions 9-11)
Syntax error (line where there is usage in const and arrow functions)
Object doesn't support property or method 'startsWith'
What am I missing ? I wonder if I'm misusing babel or perhaps something else is missing. I'm totally frustrated here because I already spent so much time figuring why nothing work properly in IE when Vue 2 components are involved. Any help or advise here will be highly appreciated !
app.js:
require('./bootstrap');
var Promise = require('es6-promise').Promise;
require('babel-polyfill')
Promise.polyfill();
window.Vue = require('vue');
import Vue2Filters from 'vue2-filters'
import BootstrapVue from 'bootstrap-vue'
my webpack.mix.js (tried to install babel)
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.babel('out.es6.js', 'out.js')
.options({
polyfills: [
'Promise'
]
});
my package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"build": "babel src -d lib"
},
"devDependencies": {
"accounting": "^0.4.1",
"axios": "^0.15.3",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-vue-app": "^1.3.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.3",
"jquery": "^3.1.1",
"laravel-mix": "0.*",
"lodash": "^4.17.4",
"vue": "^2.4.2",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.8.1"
},
"dependencies": {
"bootstrap-vue": "^1.0.0-beta.7",
"es6-promise": "^4.1.1",
"vee-validate": "^2.0.0-beta.17",
"vue-events": "^3.0.1",
"vue-strap": "^1.1.37",
"vue2-filters": "^0.1.9",
"vuelidate": "^0.5.0"
}
}
I succeeded to resolve the problem by running the babel code, echoing the results to specific location:
my .bashrc:
{
"presets": ["es2015"]
}
command:
./node_modules/.bin/babel public/js/app.js > public/js/out.js
Then in the layouts files I included public/js/out.js file instead of public/js/app.js
when i use npm update , i can update all package , but package version number in package.json not change , in the package.json , have devDependencies and dependencies , like this :
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jquery": "^1.11.2"
},
"devDependencies": {
"lodash": "^2.4.1"
}
}
how to use one line command update all package and all package numbner in devDependencies and dependencies will update too.
One easy step:
$ npm i -g npm-check-updates && ncu -a && npm i
That is all. All of the package versions in package.json will be the latest.
From npm documentation:
When you want to update a package and save the new version as the
minimum required dependency in package.json, you can use:
npm update -S
or
npm update --save
Also As with all commands that install packages, the --dev flag will cause devDependencies to be processed as well. so your desired command is:
npm update --dev --save
Note that npm will only write an updated version to package.json if it installs a new package.
By typing these commands in terminal you can update to latest dependencies in package.json
npm i -g npm-check-updates
and go to your angular project with package.json and run:
ncu -u -a
it will update all of your dependencies to the latest.