Elixir Laravel SyntaxError: Unexpected token - css

I made some changes to my gulpfile.js. Then I received the following syntax error in my terminal after executing the gulp command:
'version' errored after 657 μs
SyntaxError: Unexpected token }
at Object.parse (native)
at VersionTask.deleteManifestFiles (/var/www/html/work/node_modules/laravel-elixir/dist/tasks/VersionTask.js:114:29)
at VersionTask.gulpTask (/var/www/html/work/node_modules/laravel-elixir/dist/tasks/VersionTask.js:72:18)
at VersionTask.run (/var/www/html/work/node_modules/laravel-elixir/dist/tasks/Task.js:139:31)
at /var/www/html/work/node_modules/laravel-elixir/dist/tasks/GulpBuilder.js:60:37
at Array.forEach (native)
at Gulp.<anonymous> (/var/www/html/work/node_modules/laravel-elixir/dist/tasks/GulpBuilder.js:59:54)
at module.exports (/var/www/html/work/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/var/www/html/work/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/var/www/html/work/node_modules/orchestrator/index.js:214:10)
Looking in my public/build/css directory I noticed all my css versions are incorrect. How could this happen? How should I fix it?
gulpfile.js
const elixir = require('laravel-elixir');
require('laravel-elixir-vue');
elixir(mix => {
// for the application, after login
mix.sass(['styles.scss','imports.scss'])
.version(['css/styles.css','css/imports.css']);
});

After opening the rev-manifest.json file in the public/build/ directory, I discovered it was somehow missing css/imports-xxxxxxx.cssin the json list. I deleted rev-manifest.json and entered the command gulp. Now after opening rev-manifest.json all the css files are listed and the error is gone.

Related

NextJS throws random "Error: Cannot find module './undefined'"

I just encountered this error while navigating to different links using NextJs's Link Component; Once this error showed up, I couldn't access any pages until I restarted the npm run build command, and everything worked properly again.
However, I can't figure out what caused this error and I wanted to make sure this doesn't happen in my production app. Does anyone have an idea what might have caused this error?
Error: Cannot find module './undefined'
Require stack:
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/pages/_document.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/require.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/load-components.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/utils.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/store.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/index.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/cli/next-dev.js
- /Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/bin/next
at Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at mod._resolveFilename (/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/webpack/require-hook.js:183:28)
at Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at __webpack_require__.f.require (/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js:233:28)
at /Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js:160:40
at Array.reduce (<anonymous>)
at __webpack_require__.e (/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js:159:67)
at Array.map (<anonymous>) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/webpack-runtime.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/.next/server/pages/_document.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/require.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/server/load-components.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/utils.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/store.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/build/output/index.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/cli/next-dev.js',
'/Users/tylerkim/Documents/GitHub/scraft/scraft-app/node_modules/next/dist/bin/next'
]
}
error - Error: Cannot find module './undefined'
You're trying to import a page called undefined in /pages/_document.js, which I imagine isn't what you really want to do.
Can you add your _document page import code?

Uncaught TypeError: Cannot read property 'register' of undefined

I'm using pushpad.xyz for push notifications in my wordpress project. I added pushpad code but I get this error which I can't understand.
pushpad.js:292 Uncaught TypeError: Cannot read property 'register' of undefined
at Object.registerServiceWorker (pushpad.js:292)
at Object.init (pushpad.js:261)
at init (pushpad.js:362)
at window.pushpad (pushpad.js:548)
at pushpad.js:551
at Array.forEach (<anonymous>)
at pushpad.js:550
at pushpad.js:553
Could some one explain why I'm getting this error. Because this error is coming only in this wordpress project which I'm running in a virtual machine using vagrant. Is this the reason for the error? If yes how can I fix it?
The relevant line in pushpad.js that raise the error is the following:
navigator.serviceWorker.register(_.options.serviceWorkerPath, { updateViaCache: 'none' });
Thus the error indicates that navigator.serviceWorker is undefined: probably you are using an old or buggy browser version.

Patch update to Meteor 1.4.1.2 fail to find program.json

The command to update Meteor meteor update --patch gave the error:
$meteor update --patch
/Users/empl1/.meteor/packages/meteor-tool/.1.4.1_2.5y3whq++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/ddp/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:165
throw error;
^
Error: ENOENT: no such file or directory, open '/private/var/folders/8y/63l591316sz2mxwr1kq551bm0000gp/T/mt-hqj7n0/plugin.compileLessBatch.os/program.json'
at Error (native)
Any idea what can fix this? Thanks

Why does grunt.loadNpmTask('grunt-contrib-jshint') trigger an error in Sails.js?

This seems pretty straightforward, but I can't seem to debug this error. I've added this code to my Sails API as /tasks/config/jshint.js
module.exports = function(grunt) {
console.log(1);
grunt.config.set('jshint', {
files: {
src: ['api/services/*.js', 'api/policies/*.js', 'api/controllers/*.js']
}
});
console.log(2);
grunt.loadNpmTask('grunt-contrib-jshint');
console.log(3);
};
Now, when I execute any grunt task, I get an error message (but the older tasks still execute successfully).
C:\dev\fo-rest-api>grunt aglio
1
2
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: undefined is not a function
Running "aglio:your_target" (aglio) task
...
Done, without errors.
When I run the jshint task, I get the same loading error and the task is aborted.
C:\dev\fo-rest-api>grunt jshint
1
2
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: undefined is not a function
Warning: Task "jshint" not found. Use --force to continue.
Aborted due to warnings.
C:\dev\fo-rest-api>
A few other notes:
Using --force only changes the wording of the error message.
grunt-contrib-jshint seems to be successfully installed in /node_modules (I deleted everything and re-ran npm install to be sure.
I'm running this on Windows, if that matters. I've tried opening the command line as both a normal user and as administrator.
I tried commenting out the loadNpmTask line to see if sails would load it automatically, but still got Warning: Task "jshint" not found.
Thanks for any clues you might have.
The answer was pretty straightforward. I somehow deleted the s at the end of grunt.loadNpmTasks. When I added it back, everything worked well.
I wish there was some sort of syntax highlighting that for common packages like grunt that would identify this kind of typo...

Unable to execute grunt file

I am new bee to gruntjs , i am facing small issues. pls dont mark as -ve .Thanks people
I have the following code in Gruntfile.js
module.export = funtion(grunt){
grunt.registerTask('default',"", function(){
grunt.log.write("Tis a a task ");
});
};
i am trying to execute the above js file from cmd prompt as follows and it throws the following error.
D:\vkishore\Demo\Condo_gruntjsDemo>grunt
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token {
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.

Resources