I have the grunt-ember-templates plugin, and it used to work. But I did a npm install and it got messed up. Now it does not compile.
The error is this:
Running "watch" task
Waiting...
>> File "resources\hbs\index\module.hbs" changed.
Running "emberTemplates:compile" (emberTemplates) task
>> ReferenceError: ember-template-compiler.js:22258
>> module.exports = Ember.__loader.require("ember-template-compiler");
>> ^
>> module is not defined
Warning: Ember Handlebars failed to compile resources/hbs/error.hbs. Use --force to continue.
Aborted due to warnings.
My Gruntfile.js looks somehow like this:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
emberTemplates: {
compile: {
options: {
templateBasePath: /resources\/hbs\//,
// Path to the ember-template-compiler of my ember version
templateCompilerPath: 'resources/js/libs/ember-template-compiler.js',
handlebarsPath: 'node_modules/handlebars/dist/handlebars.js'
},
files: {
'resources/js/templates.js': 'resources/hbs/**/*.hbs'
}
}
},
...
Any idea? thanks in advance.
FWIW, it was just a dependency problem. Modifying the package.json to include the latest packages fixed it.
Related
I'm using Angular 14 ang webpack version: ^5.58.1.
Below is the config:
webpack.congif.js
const webpackPlugin = require('#ngtools/webpack').AngularWebpackPlugin;
module.exports = {
mode: 'development',
devtool: "source-map",
entry: {
main: "./js/main.js",
mainDrawer: "./js/divdrawer/main.ts",
polyfills: "./js/divdrawer/polyfills.ts",
entry: "./js/entry.js",
thirdpartylibs: "./js/thirdpartylibs.js"
},
output: {
path: path.join(__dirname, "build/"),
filename: "[name]bundle.js"
},
module: {
rules: [
{
parser: {
system: true,
}
}
test : /\.(tsx|ts)$/,
use: [
{
loader: '#ngtools/webpack',
options: {
configFile: path.resolve('./js/tsconfig.json')
},
},
]
},
},
plugins: [
new webpackPlugin({
tsconfig: './js/tsconfig.json',
}),
new webpack.ContextReplacementPlugin(
/\#angular(\\|\/)core(\\|\/)esm5/,
path.resolve(__dirname, "./js/divdrawer")
)
]
}
While generating the build I'm getting below error:
ERROR in ./js/divdrawer/filterMappingRemover.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
# ./js/entry.js 10:30-97
ERROR in ./js/divdrawer/main.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
at processTicksAndRejections (internal/process/task_queues.js:95:5)
ERROR in ./js/divdrawer/polyfills.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
ERROR in ./js/divdrawer/renderer.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
# ./js/entry.js 9:18-61
All the entries are throwing the errors with above message. As mentioned in webpack config we have multiple entries.
This is detected when I upgraded our project to angular 14.(Angular upgrade Steps: v10 --> v11--> v12--> v13/v14)
How to configure AngularWebpackPlugin correctly? Is there any alternative way?
For me this solution worked:
go to package.json and change your typescript version, If you want to upgrade your angular project to
Angular 15 (npm install typescript#"~4.8.0" --save-dev)
"devDependencies": {
...
"typescript": "~4.8.0"
}
Angular 14 (npm install typescript#"~4.7.0" --save-dev)
"devDependencies": {
...
"typescript": "~4.7.0"
}
Credit to F.R
yes downgrading typescript version to 4.8.2 resolve the issue.
For me, upgrading node version 16.xx to 18.xx (LTS) fixed the issue.
How do I configure Heroku CI to run System tests?
This is my app.json, where I included what I thought would be the necessary buildpacks:
{
"environments": {
"test": {
"scripts": {
"test-setup": "bin/rails assets:precompile",
"test": "bin/rails test:system"
},
"addons":[
"heroku-postgresql:in-dyno"
],
"buildpacks": [
{ "url": "https://github.com/heroku/heroku-buildpack-google-chrome" },
{ "url": "heroku/nodejs" },
{ "url": "heroku/ruby"}
]
}
}
}
But when I deploy, I get the following error:
-----> Running test command `bin/rails test:system`...
rails aborted!
Webdrivers::BrowserNotFound: Failed to find Chrome binary.
I suspect I am missing something very basic....
I running Rails 6.0.1 and Ruby 2.6.3.
Did you setup your webdriver correctly to find the correct binary as mentioned on the official UAT wiki page of heroku?
Add gem 'webdrivers' to your Gemfile.
Add the following code snippet to your test_helper.rb (as stated on heroku buildback wiki and on webdrivers wiki):
require 'webdrivers' # Make sure webdrivers are loaded.
chrome_bin = ENV['GOOGLE_CHROME_SHIM'] if ENV['GOOGLE_CHROME_SHIM'].present?
chrome_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
# You may want to use a different args
args: %w[headless disable-gpu window-size=1400x1400],
binary: chrome_bin
}
)
Capybara.register_driver :heroku_chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: chrome_capabilities)
end
Afterwards tell your system test to use your custom chrome driver by adding it to your application_system_test_case.rb.
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :heroku_chrome
end
I have a django blog project, and am trying to use bower to manage my packages.
When running 'gulp' from my console, I get the following error :
(py3) ➜ nomadpad git:(master) ✗ gulp
[15:16:15] Using gulpfile ~/code/nomadpad/gulpfile.js
[15:16:15] Starting 'css'...
[15:16:16] Finished 'css' after 1.23 s
[15:16:16] Starting 'html'...
[15:16:16] Finished 'html' after 3.38 ms
[15:16:16] Starting 'scripts'...
[15:16:16] Finished 'scripts' after 4.43 ms
[15:16:16] Starting 'default'...
[15:16:16] Finished 'default' after 38 μs
events.js:182
throw er; // Unhandled 'error' event
^
CssSyntaxError: /Users/davidmellor/code/nomadpad/bower_components/jquery/dist/jquery.js:756:9: Unknown word
at Input.error (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/input.js:119:22)
at Parser.unknownWord (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/parser.js:506:26)
at Parser.other (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/parser.js:171:18)
at Parser.parse (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/parser.js:84:26)
at parse (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/parse.js:24:16)
at new LazyResult (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/lazy-result.js:70:24)
at Processor.process (/Users/davidmellor/code/nomadpad/node_modules/postcss/lib/processor.js:117:12)
at /Users/davidmellor/code/nomadpad/node_modules/gulp-postcss/index.js:51:12
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
My bower.json in the root folder looks like this :
{
"name": "blog_postcssgulp",
"description": "",
"main": "gulpfile.js",
"authors": [
"DMells <dave#davemellor.com>"
],
"license": "ISC",
"homepage": "https://github.com/DMells/nomadpad",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "^3.3.1",
"modernizr": "^3.5.0"
}
}
I'm not sure what to do here, please can anyone assist?
Many thanks
If anyone else comes across this, I found the solution by removing my bower_components folder and then reinstalling bower, as well as the jquery package.
npm install bower --save-dev
And then the jquery package:
bower install jquery --save-dev
I have newman 3.9.3 version installed on my ubuntu box. Want to execute multiple collections from a folder but executing js file through me wired error saying
TypeError: newman.run is not a function.
Here is my execution script. Any help will be appreciated.
#!/usr/bin/env node
var newman = require(process.env.NVM_BIN+'/newman');
var fs = require('fs');
fs.readdir('./collections', function (err, files) {
if (err) { throw err; }
files = files.filter(function (file) {
return (file.substr(-5) === '.json');
});
// now wer iterate on each file name and call newman.run using each file name
files.forEach(function (file) {
newman.run({
environment: require(`${__dirname}/live.postmane_environment.json`),
collection: require(`${__dirname}/collections/${file}`),
reporters: ['cli']
}, function (err) {
console.info(`${file}: ${err ? err.name : 'ok'}!`);
});
});
});
Following is the exact error.
/app/postman/execute:15
newman.run({
^
TypeError: newman.run is not a function
at /app/postman/execute:15:16
at Array.forEach (native)
at /app/postman/execute:14:11
at FSReqWrap.oncomplete (fs.js:123:15)
For the time being, I've solved this problem by using bash script to run all of my collections available in a folder. that has done the job. but originally i could not understand why "run" is not available for "newman" object.
I was getting the same error message and solved installing the nodejs package:
npm install --save newman
Basically, when you make the bin as reference the nodejs doesnt know how to run:
Instead of:
var newman = require(process.env.NVM_BIN+'/newman');
Should be:
var newman = require('newman');
is any option for verbore output for testing by jest?
I can see which modules are mocked.
I tried
jasmine.VERBOSE = true;
but not working.
Thanks for answer.
To get verbose mode in Jest, you can run Jest with the --verbose tag.
In your packages.json, you can write:
"scripts": {
"test": "jest --verbose"
},
Then you can run npm test
Alternatively, if you are using gulp-jest, to get Jest in verbose mode, find the index.js file of the gulp-jest folder in node_modules and add a verbose: true to the jest.runCLI block.
jest.runCLI({
config: options,
verbose: true
}
simple add in package.json
{
...
...
"jest": {
"verbose": true
},
...
...
}
Create jest.config.js file in root directory and add this to the module export
module.exports = {
// some code here..
verbose: true,
// some code here...
}