I have install karma-requirejs and requires,but when running Karma,The console prompt "No provider for "framework:requirejs"";
please help me,thank you!!
I know this issue is a bit older but I hit it while searching for a solution, so maybe this helps other to solve their problem quicker.
Even without code it might be due to missing the karma-requirejs plugin reference. (That's the issue I just had.)
Just add it to your karma.conf.js:
module.exports = function(config) {
config.set({
...
plugins: [
...
'karma-requirejs'
],
...
});
};
You also might need to install it via npm install karma-requirejs --save-dev if not yet done.
Related
I'm fairly new to the linux webapp development scheme but there was a readme attached with the project that the previous team left me.
It said I have to call
sudo npm install
bower install
grunt build/grunt server.
firstly, my bower.json is empty with the exception of
{
"name": "webapp",
"dependencies": {
"roslib": "~0.15.0"
}
}
and secondly when I call grunt build I get the error
error Parsing error: Unexpected token let
I also get the same error with the tokens '<' and 'ILLEGAL'
Edit: I found that grunt build is defined as
grunt.registerTask('build', ['eslint', 'browserify', 'concat_css', copy']);
You should talk to the previous team and ask them about the project and get some rampup. You should probably also do at least a few tutorials on node/grunt/whatever else they're using.
As for your issues, firstly there's nothing wrong with the bower.json only having one dependency, that's not an issue. Bower seems to be declining though so you could also get roslib through npm, though you'd have to understand enough about the project to replace where it's being used to be from node_modules.
You're probably getting the error on grunt because they've used let in their Gruntfile.js and you're on an old version of node that doesn't support let yet. The latest long term support of node.js is 6.10.3. I would update if you can.
I am not really sure how I got into this pickle.. I uninstalled my global webpack and reinstalled it locally to dockerize my project. Then I got a trail of errors, resolved the ones I could and I'm left with this
http://puu.sh/orazd/b8a85ac5c6.png
I don't use any module called apply, most certainly not in every file
I had tried resolveLoader previously
and it had worked for me.
My configuration is as follows:
resolveLoader: {
modulesDirectories: [
'/users/path/a/node_modules'
]
},
Hope this helps.
Though not sure, I think maybe something wrong, like conflicts, in the typings folder. Would you try to remove typings folder and run npm install again.
The answer turned out to be
silly enough.. the error was a little misleading but.
I've been trying to use the jshint grunt module to validate my code, but I always get the following error:
Running "jshint" task
[D] Task source: C:\Coursera\03. Intro Angular JS\conFusion\node_modules\grunt-contrib-jshint\tasks\jshint.js
Running "jshint:all" (jshint) task
[D] Task source: C:\Coursera\03. Intro Angular JS\conFusion\node_modules\grunt-contrib-jshint\tasks\jshint.js
Verifying property jshint.all exists in config...OK
Files: Gruntfile.js, app/scripts/app.js
Options: force=false, reporterOutput=null, jshintrc=".jshintrc", reporter={}
Warning: Path must be a string. Received { toString: [Function], reporter: [Function] } Use --force to continue.
the problem is that even using the --verbose and -debug, it doesnt show anything to work on the error, just "path must be a string", i validated the file with JSLint (using brackets) and it works quite well, website also works fine.
what i have done so far.
Unistalled node.js and node modules 3 times (trying something different everytime).
tried to limit my grunt task to simply validate a very simple js file, and also doesnt work, it means thats not related to the code or my gruntfile.js.
I fixed this issue by updating grunt-contrib-jshint from "0.10.0" to "0.12.0".
I was still getting the error after updating node to v6.4.0.
What helped me was this comment on github (by Jeff Peck):
I have found the issue to be when the reporterOutput option is set to
null. If you change that option to refer to an empty string, jshint
will work as expected:
options: {
jshintrc: '<%= baseDir %>/.jshintrc',
reporterOutput: "",
...
Doing that allowed grunt jshint to complete.
EDIT:
Well, I did have updated node, but not grunt-contrib-jshint, as per Zeid Selimovic's answer. That works and is better than previous workaround
I got the issue just after updation of node (v6.9.2). It got resolved after updating grunt-contrib-jshint to the latest version ("1.1.0") by following steps:
npm uninstall grunt-contrib-jshint --save-dev
npm install grunt-contrib-jshint --save-dev
Let's say I have a node package like so:-
var debug = require('debug');
debug('starting..');
module.exports = function(){
debug('printing..');
return 'Hello World';
};
And I include debug package as my devDependencies and publish my package in npm. Now when someone installs my package then obviously debug package won't be installed on their end as it's a devDependencies so when the user runs my program it's going to throw error as s/he doesn't have that package installed.
Now, technically I could do this:-
var debug = process.env.DEBUG ? require('debug') : '';
and it'd be fine since the user is specifically trying to debug the program and throwing him/her error is not a problem but what I'd like to know is how do you guys handle this? Just leave debug as dependency of your app? And is there any other solution to this? Any solution is appreciated. Thanks.
So, armed with this tutorial, I decided to add some unit testing to my node.js app. My gruntfile seems to be OK, and when I type grunt nodeunit my only test runs just fine, but after that, it crashes with error Fatal error: Cannot find module 'tap':
$> grunt nodeunit
Running "nodeunit:all" (nodeunit) task
Testing db.test.js
.OK
Fatal error: Cannot find module 'tap'
I didn't know anything about this module, but after googliing it up, it seemed that it's something nodeunit would require. And indeed, there it is: $MY_NODE_APP/node_modules/nodeunit/node_modules/tap exists, and when I launch node in $MY_NODE_APP/node_modules/nodeunit and type require('tap') in interactive console, I get some object with a lot of stuff that gives me an impression that it works as it should.
So, the obvious question: why do I get this error, and how can I fix it?
Gruntfile:
module.exports = function(grunt) {
grunt.initConfig({
nodeunit: {
all: ['./**/*.test.js']
}
});
grunt.loadNpmTasks('grunt-contrib-nodeunit');
};
Update: Installed tap to my project, but it didn't help too.
I landed on this question and have since resolved my own issue. I'll post my resolution as it might be helpful to someone else:
First the similarities:
I was just getting my Gulp scripts setup, and I got this error when running my tests:
Fatal error: Cannot find module 'tap'
Which didn't make sense because I wasn't using that library!
How I resolved:
Turns out my paths were all kind of screwed up in my gulpfile.js. Therefore I was trying to unit test all of the modules in my node_modules folder!
Here's the new path:
paths: {
mocha: [
'**/*.test.js',
'!node_modules/**/*.js'
]
}
The issue for me was that I was inadvertently running the tests within the node_modules directory. My npm test was mocha **/*.test.js and when I changed it to mocha src/**/*.test.js all of a sudden the message went away. Makes sense really.
I have solved the problem by adding another '*' right after "mocha" it is related to the folder's path so it may also fix the problem in other cases.
I solved the issue (well, this issue — it wasn't the last one) by installing the tap module manually.