I would like to install grunt and grunt-cli to my OpenShift deployment (which is a Python 2.7 cartridge).
I have created a package.json file as follows:
{
"author": "--",
"name": "--",
"version": "0.3.0",
"homepage": "--",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli" : "~0.1.13",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-html2js": "^0.2.9",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-index-html-template": "^0.2.5",
"grunt-contrib-watch": "^0.6.1"
}
}
However, after SSHing into the server post deployment, grunt is not installed. My questions are:
requirements.json is more of a Node thing. Therefore, is it that OpenShift ignores this file because I am not using Node (even though NPM is installed).
If 1 is correct, how do I go about installing grunt? (I've tried running 'npm install -g grunt' both via SSH and in an action hook script, but the fails due to lack or permissions).
This guy had the same issue (Can I run Grunt/Gulp on my PHP 5.4 cartridge?) but I couldn't find what I needed in the answer.
Any suggestions?
you'll need to run scl enable nodejs010 in your ./action-hook/start command to enable a specific software collection in your gear. Hopefully that helps!
Related
Background
I'm trying to setup a Remix app using Tailwind CSS for styling and Prettier for styling. Recently the Tailwind team released their official classes-sorting plugin but for some reason Prettier says it "can't find it".
The error looks like the following in the Prettier output:
["INFO" - 1:17:09 PM] Formatting file:///home/juanzitelli/dev/human-decode/burger-reviews-hd/app/routes/dashboard/index.tsx
["ERROR" - 1:17:09 PM] Error resolving prettier configuration for /home/juanzitelli/dev/human-decode/burger-reviews-hd/app/routes/dashboard/index.tsx
My file structure (files related to the problem) looks like this:
/prettier.config.js
/tailwind.config.js
/package.json
"devDependencies": {
"#remix-run/dev": "^1.1.3",
"#remix-run/serve": "^1.2.2",
"#types/node": "^17.0.21",
"#types/react": "^17.0.24",
"#types/react-dom": "^17.0.9",
"autoprefixer": "^10.4.2",
"concurrently": "^7.0.0",
"dotenv": "^16.0.0",
"postcss": "^8.4.6",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.8",
"prisma": "^3.10.0",
"tailwindcss": "^3.0.23",
"typescript": "^4.1.2"
},
"engines": {
"node": ">=14",
"yarn": "1.22.17"
},
Prettier config
`/prettier.config.js`
module.exports = {
plugins: [require('prettier-plugin-tailwindcss')],
};
> When hovering over that "require" I get an error that says:
module "/home/juanzitelli/dev/human-decode/burger-reviews-hd/node_modules/prettier-plugin-tailwindcss/dist/index"
Could not find a declaration file for module 'prettier-plugin-tailwindcss'. '/home/juanzitelli/dev/human-decode/burger-reviews-hd/node_modules/prettier-plugin-tailwindcss/dist/index.js' implicitly has an 'any' type.
Try `npm i --save-dev #types/prettier-plugin-tailwindcss` if it exists or add a new declaration (.d.ts) file containing `declare module 'prettier-plugin-tailwindcss';`ts(7016)```
I encountered this problem too before. Though I just tried adding the Tailwind Prettier plugin to a new Remix project and everything seems to be working. Here are the steps I performed:
Installed Tailwind npm install -D tailwindcss postcss autoprefixer concurrently
After finishing all the steps outlined in the link above, I ran npm install -D prettier prettier-plugin-tailwindcss
I don't have a prettier config file in place. I'm able to run Prettier through vscode and I can confirm that the Tailwind classes are automatically sorted.
I have tried to find similar problem in stackoverflow but no one can solve my issue.
I am trying to test my firebase security rules, using Typescript and Mocha, but I can't even run my test
here is my project directory
I install my dev dependecies using this code:
npm install chai mocha ts-node #types/chai #types/mocha --save-dev
here is my dev dependecies
"devDependencies": {
"#firebase/rules-unit-testing": "^1.2.5",
"#types/chai": "^4.2.15",
"#types/mocha": "^8.2.2",
"#types/uuid": "^8.3.0",
"#typescript-eslint/eslint-plugin": "^3.9.1",
"#typescript-eslint/parser": "^3.8.0",
"chai": "^4.3.4",
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"mocha": "^8.3.2",
"ts-node": "^9.1.1",
"typescript": "^3.9.9"
},
and here is my script npm
"scripts": {
"test": "mocha --exit"
},
but when run npm run test , from functions directory I have error
Error: No test files found: "test"
I have tried using
mocha --require ts-node/register --watch-extensions ts 'test/**/*.ts'
I still have the same error. what should I do?
I finally can run the test using
mocha -r ts-node/register src/**/*.test.ts --timeout 60000 --exit
don't forget to install ts-node as dev dependecy and please note that the file name should be in format
myFileName.test.ts
Upon trying to update my pods to the latest in order to work with IOS 12.0 I keep getting this error. I've seen this error pretty well documented online but none of the current solutions I have found seem to work.
In Podfile:
RNFBApp (from `../node_modules/#react-native-firebase/app`) was resolved to 10.5.0, which depends on
Firebase/CoreOnly (~> 7.4.0)
RNFBAuth (from `../node_modules/#react-native-firebase/auth`) was resolved to 10.5.1, which depends on
Firebase/Auth (~> 7.4.0) was resolved to 7.4.0, which depends on
Firebase/CoreOnly (= 7.4.0)
react-native-camera/BarcodeDetectorMLKit (from `../node_modules/react-native-camera`) was resolved to 3.42.0, which depends on
Firebase/MLVisionBarcodeModel was resolved to 5.0.0, which depends on
Firebase/CoreOnly (= 5.0.0)
As far as pod install --repo-update and pod update etc I keep returning to this error. I've updated my dependancies manually in the package.json file to the latest and removed the pod.lock file. I've run a react native clean across it to ensure all cache files are cleaned and tried to reinstalling everything and still getting the error.
I'm sure I'm missing something that I either need to wipe somewhere but can't find where exactly I need to do this.
Here's my Pod file
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.0'
target 'shoppinStore' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'shoppinStoreTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'shoppinStore-tvOS' do
# Pods for shoppinStore-tvOS
target 'shoppinStore-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
# add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'BarcodeDetectorMLKit'
]
And my Package.json
"name": "shoppinStore",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/checkbox": "^0.5.7",
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-firebase/app": "^10.5.0",
"#react-native-firebase/auth": "^10.5.1",
"#react-native-firebase/firestore": "^10.5.1",
"#react-navigation/bottom-tabs": "^5.11.3",
"#react-navigation/native": "^5.9.0",
"#react-navigation/stack": "^5.13.0",
"firebase": "^8.2.3",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-camera": "^3.42.0",
"react-native-gesture-handler": "^1.9.0",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-navigation": "^4.4.3",
"react-redux": "^7.2.2",
"redux": "^4.0.5"
},
"devDependencies": {
"#babel/core": "^7.8.4",
"#babel/runtime": "^7.8.4",
"#react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^25.1.0",
"eslint": "^6.5.1",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
I'm pretty new to React Native, this all happened after chasing errors trying to connect my phone to test the app to get the React Native Camera library to work. Not the project won't build at all. Any pointers will be greatly appreciative.
I had this problem due to M1 chip.
I deleted Pods folder
Deleted PodFile.lock
For M1 chip :
1. Install ffi
sudo arch -x86_64 gem install ffi
2. Re-install dependencies
arch -x86_64 pod install
I was getting this also so I updated my firebase packages in package.json, deleted podfile.lock in the ios folder, and ran pod repo update, then pod install.
Worked after that! Good luck!
I'm trying to set up grunt-sass for the first time on a new .Net Core 3.1 web app. I've gone through MSFT's steps to add grunt to a project here outlined here and then modified it with the steps from the grunt-sass instructions here.
This however causes task runner explorer to state there are no tasks found.
Here is my package.json:
{
"name": "chapelstudios_www",
"version": "0.0.2",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://me#bitbucket.org/me/chapelstudios_www.git"
},
"author": "mr",
"license": "ISC",
"homepage": "https://bitbucket.org/me/chapelstudios_www#readme",
"private": true,
"devDependencies": {
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-sass": "^3.1.0",
"node-sass": "^4.13.1"
},
"dependencies": {
"gulp": "^4.0.2"
}
}
And this is my gruntfile.js:
const sass = require('node-sass');
require('load-grunt-tasks')(grunt);
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Sass
sass: {
options: {
implementation: sass,
sourceMap: true, // Create source map
outputStyle: 'compressed' // Minify output
},
dist: {
files: [
{
expand: true, // Recursive
cwd: "Styles", // The startup directory
src: ["**/*.scss"], // Source files
dest: "wwwroot/css", // Destination
ext: ".css" // File extension
}
]
}
}
});
// Load the plugin
grunt.loadNpmTasks('grunt-sass');
// Default task(s).
grunt.registerTask('default', ['sass']);
};
I'm not sure how to get any more detailed error info then that but have tracked down the issue to the
const sass = require('node-sass');
line that is required by the grunt-sass instructions. If I change it to the string 'sass' that is recommended by older tutorials the task shows but fails when I attempt to actually run it.
I've also ran the following installations from an elevated powershell window in the project directory in an attempt to make sure they were installed into the project locally as I hear that to be a main issue:
npm install
npm install grunt
npm install grunt-cli
npm install --save-dev node-sass grunt-sass
At this point I'm out of ideas but I'm a newb so I'm sure I'm missing something obvious.
For anyone else visiting this with an existing project, I was having this issue with a pre-existing node-sass / grunt file on a new computer, and I found that bumping up the version of node-sass in my package.json caused VS to reinstall the packages and update the bindings as noted in the other answer.
I have a slight suspicion that there's a difference in versions between running grunt in my command prompt and whatever VS uses, since my grunt file worked just fine if I ran it manually, but would not show up in Task Runner Explorer.
Reviving an old topic but here is what worked for me. YMMV.
In Visual Studio, go to: Tools -> Options -> Web Package Management
-> External Web Tools.
Move $(PATH) above $(VSInstalledExternalTools).
I have no idea if there are any side effects to doing this.
credit to: https://developercommunity.visualstudio.com/solutions/314606/view.html
I found the following error which led me to do a rebuild:
Error: Missing binding A:\Projects\Repos\chapelstudios_www\node_modules\node-sass\vendor\win32-x64-79\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 13.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 10.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
As Jake mentioned I tracked the error down to this line as well:
const sass = require('node-sass');
Running rebuild didn't work. I found that after upgrading node from version 10.x to current version (12.18 Windows) and then rebuilding fixed the issue.
npm rebuild node-sass
edit - There is something strange: mongo appears in both package.json and in .meteor/packages files (should it appear in package.json at all?? it wasn't there before the update) but in different versions. here is my package.json:
{
"name": "something",
"version": "1.1.1",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"#babel/runtime": "^7.0.0-beta.49",
"babel-runtime": "^6.26.0",
"bootstrap": "^3.3.7",
"google-protobuf": "^3.5.0",
"grpc": "^1.12.2",
"grpc-tools": "^1.6.6",
"meteor-node-stubs": "^0.3.3",
**"mongodb": "^3.1.0-beta4",**
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react-progressbar.js": "^0.2.0",
"react-router": "^3.2.1",
"react-router-dom": "^4.2.2"
}
}
and here is my .meteor/packages:
meteor-base#1.3.0 # Packages every Meteor app needs to have
mobile-experience#1.0.5 # Packages for a great mobile UX
**mongo#1.4.2 # The database Meteor supports right now**
blaze-html-templates#1.0.4 # Compile .html files into Meteor Blaze views
reactive-var#1.0.11 # Reactive variable for tracker
tracker#1.1.3 # Meteor's client-side reactive programming library
standard-minifier-css#1.4.0 # CSS minifier run for production mode
standard-minifier-js#2.3.1 # JS minifier run for production mode
es5-shim#4.7.0 # ECMAScript 5 compatibility for older browsers
ecmascript#0.10.6 # Enable ECMAScript2015+ syntax in app code
shell-server#0.3.1 # Server-side component of the `meteor shell` command
session#1.1.7
tarang:ssl
After updating to 1.6.1.1, my app won’t run, crashing with message 'Error: Cannot find module “mongodb” '.
Tried to run meteor npm install, even took away the entire node_modules folder and built it again.
Tried to run meteor npm update.
Tried to run meteor npm install mongodb.
Tried to downgrade back to version 1.6.0.1.
Still can’t find mongodb.
Important - mongodb is there, all collections are there - I can access it through the terminal with "meteor mongo".
Any help?
If it helps - The data in the db can be erased if there is no other way.
(running on ubuntu 16.04)
Thanks
In the end, the problem was not in the project but in meteor globally, so I uninstalled and re-installed meteor globally, and everything got back to normal…
Thank you all!