Why isn't quasar "build" a known command? - bitbucket-pipelines

I'm running quasar build in my bitbucket pipeline but the output is: Error Unknown command "build"
Anybody know why this happens? I basically want to just push my code and let bitbucket pipeline take care of the rest.
image: node:10.15.3
pipelines:
branches:
master:
- step:
name: Building Quasar
caches:
- node
script:
- yarn global add #quasar/cli
- quasar build
- do some other stuff
artifacts:
- path/to/artifact
- step:
name: Deploying to S3
caches:
- node
script:
- cp $BITBUCKET_CLONE_DIR/path/to/artifact path/to/artifact
- pipe: atlassian/aws-s3-deploy:0.3.8
variables:
...

It's a common mistakes that occurred during getting packages with package manager. In default yarn package manager doesn't get dev dependencies if NODE_ENV set to production.
You have 3 solutions:
move all packages from dev dependencies to dependencies(that is not rational).
Set NODE_ENV to development.
Run Yarn install --production=false when you want to get all dependencies.

from https://forum.quasar-framework.org/topic/5283/unknown-command-build-circleci/5
run: npm install && npm install --only=dev
In my case fixed executing like this:
npm install && npm install --only=dev
npm install #quasar/cli
npx quasar build

May happen if node_modules is not updated for that project. Run "npm install" or the equivalent for yarn. Below is a snapshot of my package.json for a project at this point in time.
"dependencies": {
"#quasar/extras": "^1.0.0",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"quasar": "^2.0.0",
"vue-i18n": "^9.0.0",
"vuex": "^4.0.1"
},
"devDependencies": {
"#babel/eslint-parser": "^7.13.14",
"#quasar/app": "^3.0.0",
"#types/node": "^12.20.21",
"#typescript-eslint/eslint-plugin": "^4.16.1",
"#typescript-eslint/parser": "^4.16.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-vue": "^7.0.0",
"workbox-webpack-plugin": "^6.4.2"
}

I hit this problem after updating my Quasar project (and migrating to Vite). My #quasar/cli utility was installed globally, and therefore it wasn't updated along with the remaining packages managed by Yarn. The solution was simple:
npm update -g #quasar/cli

Related

What is the difference between running a binary and running with npm a script from package.json?

The situation is as follows:
E.g. there is a package.json like:
{
...
"scripts": {
"build": "next build"
},
"dependencies": {
"#types/node": "^14.0.26",
"#types/react": "^16.9.43",
"next": "9.4.4",
"react": "16.13.1",
"react-dom": "16.13.1",
"typescript": "^3.9.7"
}
}
Then running npm run build in the directory of the package.json executes the script assigned to the "build" key next build.
But directly running next build results in bash: next: command not found.
I did npm install so that all the dependencies defined in package.json get installed, though in the local node_modules-directory, which lies next to the package.json, where I can find the next-binary under node_modules/next/dist/bin/.
Using that like node_modules/next/dist/bin/next build works fine. So my assumption is that the command to install the dependencies does not encompass adding the next-binary to the path in the current environment to use it separately without the defined scripts in the package.json.

Is is possible to install dependancies with single line command?

My Node.js
package.json
has following dependancies
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.4",
"mongoose": "^5.3.10",
"nodemon": "^1.18.5"
},
"devDependencies": {
"eslint": "^5.8.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0"
},
I am new to JS,so I want to know if we can somehow invoke package.json without going for
npm install
for every package.
When you use the command npm install or npm i, it will install all dependencies from your package.json.
As a result you get all the dependencies listed in the package.json from the current folder
You can see the documentation concerning this command here : npm install
Welcome to JS world, I'm fairly new to JS myself but I believe there two possible solutions to your problem:
npm install multiple dependencies
It is possible to install multiple dependencies at the same time with one npm install command, you may find more information that could be helpful in the documentation.
For example:
npm install got koa fs-extra
Here I have installed all 3 of my project dependencies at once.
Pre Populate package.json
You can manually add the package dependencies in the correct format to your package.json file. You might the npm documentation on the package.json file helpful.
You then will need to run:
npm install
This will take the dependencies in the package.json file and install them into the node_modules/ directory.

Adding SASS to React Project Stalls Yarn Start

I'm mid-way though a React project and am now adding styles and implementing SASS, and the other day while I added the packages and some styles, everything was running great. Today I go to boot it up with Yarn Start and and I'm getting:
npm WARN lifecycle The node binary used for scripts is /var/folders/hd/zrndmrss6z3cbm68fxxyt4wm0000gn/T/yarn--1553472972241-0.9303472274627695/node but npm is using /Users/kevinhyde/.nvm/versions/node/v11.10.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> test-again#0.1.0 css-watch /Users/kevinhyde/Desktop/CAREER/UW Code Camp/Post_Grad_Apps/test-again
> npm run css-build -- --watch
npm WARN lifecycle The node binary used for scripts is /var/folders/hd/zrndmrss6z3cbm68fxxyt4wm0000gn/T/yarn--1553472972241-0.9303472274627695/node but npm is using /Users/kevinhyde/.nvm/versions/node/v11.10.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> test-again#0.1.0 css-build /Users/kevinhyde/Desktop/CAREER/UW Code Camp/Post_Grad_Apps/test-again
> node-sass --omit-source-map-url sass/mystyles.scss css/mystyles.css "--watch"
I have just following packages:
"dependencies": {
"axios": "^0.18.0",
"bulma": "^0.7.4",
"bulma-extensions": "^6.2.0",
"dotenv": "^6.2.0",
"node-sass": "^4.11.0",
"react": "^16.8.3",
"react-bulma-components": "^2.3.0",
"react-dom": "^16.8.3",
"react-scripts": "2.1.5"
},
So far I have tried node re-installs on the related packages and straight up npm i, as well as npm audit to try to fix, but when I jumped back to the previous branch before adding node-sass, all's well. Any ideas?

Electron forge start is broken by Gulp

please help because this thing is driving me crazy. In short when gulp reference is added to electron-forge project app launch fails.
Node: v8.11.3
electron-forge: v5.2.2
Package.js snippet:
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"electron-compile": "6.4.3"
},
"devDependencies": {
"electron": "2.0.4",
"electron-forge": "^5.2.2",
"electron-prebuilt-compile": "2.0.4",
"gulp": "^3.9.1"
}
Steps to reproduce:
electron-forge init gulptest
npm install electron-prebuilt-compile -D
npm install gulp -D
Add electron-prebuilt-compile to devDependencies in package.json
npm run start
App will start normally, but if only one line is added to the index.js start command fails.
const gulp = require('gulp');
Once started console will output error with description:
c:\projects\electron\vendor\node\src\async-wrap.cc:357 Assertion 'env->async_hooks_init_function().IsEmpty()' failed.
This is electron issue. There is a bug opened for this and it will be fixed in one of the future releases.

Node js - cant install packages on a server

I want to have grunt on my server, and via hook, i want the server to run a grunt task that will "build" my site.
I installed node on my server, and i installed grunt-cli using this:
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo npm install -g grunt-cli
then, i go to my project folder, which is where my package.json and gruntfile.js files are located.
im using npm install and then, i see /node_modules folder but i don't see the packages there.
I don't see any error. Do you know why this happens? perhaps server configuration?
package.json
{
"name": "proj",
"version": "0.1.0",
"private": true,
"devDependencies": {
"angular": "latest",
"angular-animate": "latest",
"angular-ui-router": "latest",
"font-awesome": "^4.5.0",
"grunt": "latest",
"grunt-contrib-clean": "latest"
}
}
With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.
source: https://docs.npmjs.com/cli/install#description
Since you're on a server, I assume, this is a production one and NODE_ENV is set to production. To install both dependencies & devDependencies, run:
NODE_ENV=dev npm install

Resources