Yeoman angular-feature generator cdnify task not found - javascript

I've been looking for some automatic way to generate an angular app. I tried to use the angular generator on YEOMAN, but I didn't like the app structure provided.
I found out this other generator angular-feature(https://github.com/codigo-pl/generator-angular-feature) which seems to solve my problem. But so far I could not make it works. Every time when I try to generate the app(on feature structure) returns me an error:
command: grunt build (even if I try grunt server returns me the same)
C:\Users\xxxxxx\WorkFolders\temp\testGenerator>grunt build Loading
"cdnify.js" tasks...ERROR
Error: Unable to parse C:\Users\xxxxxx\WorkFolders\temp\testGenerator .bowerrc:
Unexpected token v Warning: Task "cdnify" not found. Use --force to
continue.
Aborted due to warnings.
UPDATE:
Inside the file .bowerrc:
{
"directory": "app\vendor/bower_components"
}
My folder after running generator:
testGenerator
--app
----src
------common
--node_modules
There's no bower_components folder in any place in my APP folder.
Has anyone already used this YEOMAN generator and had the same problem?
Is there another YEOMAN generator structured by feature like this one?

Try this command in your project to fix the issue.
npm install --save-dev grunt-google-cdn
I am really not sure why this isn't documented officially anywhere nor why the default Yeoman project generation script builds with errors. I had to execute searches to find out about this command.
Also, make sure you are using a stable version of Node/npm. One of my problems was that I was using the latest version of npm, which is 0.11.12. However, according to Node.js's website, that version is unstable. Instead, I had to use version 0.10.26, their latest stable version.
Links:
https://github.com/yeoman/generator-angular/issues/12
https://groups.google.com/forum/#!topic/yeoman-dev/3LFTPpqRInU

the problem was sorted out and it was facing me all the time.
Problem
{
"directory": "app\vendor/bower_components"
}
Solution
{
"directory": "app/vendor/bower_components"
}
The generator is generating backslash instead slash. But the strange thing it seems be happening only on windows. Ubuntu and Mavericks I don't have this problem.

Related

Why does npm try to compile a old version of my code?

I'm totally new to npm and node.js so please forgive me if I'm not giving the right detail. I'm writing a plugin for a website that uses an out-of-the-box framework in npm. It was working fine as I coded away happily, but at some point it started trying to compile a file that no longer exists.
I use npm run start to compile my html file (which contains all the javascript code as well) and get this error:
ℹ info Compiler will compile ./src/plugin.html
ℹ info Transpiling with babel
✖ error Error
SyntaxError: unknown: Unexpected token (555:3)
553 |
554 |
> 555 | });
| ^
What breaks my brain is that this simple syntax error is not present in ./src/plugin.html (I've quadruple checked this fact). This obvously pertains to an earlier version of the file.
Does npm have some kind of cache that would cause it to compile an older version of a file? I've noticed that if I remove most of the code, it compiles again, but when I replace the code it breaks again. It seems that if the file is somewhat similar to its cached version, it tries to compile the cached version and not the current version.
I've tried clearing the cache with npm --force cache clear but to no effect.
Any suggestions?
For anyone who has a similar problem with compiling code with npm, I discovered that my problem was indeed a simple syntax error. But it seems that npm became confused about what the compile error actually was. It was pointing to a line of code that did not exist in the file, and I have no idea where it got this from.
The syntax error that was the culprit in this particular case was a missing }; to close a wrapped set of functions.
So it seems that the lesson here is not to put too much trust in npm's ability to understand what syntax errors are inciting a compile error.
the only way I was able to get out of this scenario was:
rename the file
refactor the references to it, so it will compile
npm start
stop it
rename and refactor the file back to its original name
Do you try to use rebuild or something like that or npm cache clean insted of npm --force cache clear?
I had the same problem after a cancelled git rebase. The only way I could fix this was to change something in those files & revert the change after.
I recently faced this issue. If you are using typescript in your project, you may have used a wrong configuration in your tsconfig.json file that may have built the typescript files into their corresponding js files and these js files are the ones that runs every time you run the project.
for me clear catching my browser it works
Fixed by Pressing Ctrl+s !
For me vsc by default doesn't save automatically changed code like PyCharm.
Try to delete .next folder it will delete the catched files

How to configure create-react-kotlin-app in order to get kotlinx.serialization working

I've been trying to get the kotlinx.serialization library working with Kotlin/JS using the create-react-kotlin-app
However, I am not so familiar with the huge nodeJS and webpack mess.
I did the following:
1) Downloaded the kotlinx.serialization library from maven repository a located it aside the nodeJS dependencies, because there is so far no any npm module for this.
2) Modified the node_modules/#jetbrains/kotlin-webpack-plugin/plugin.js in order to compile my library, in particular I added this row to the prepareLibraries function:
opts.libraries.push(opts.packagesContents[0]["_where"]+"/lib/kotlinx-serialization-runtime-js/build/classes/main/kotlinx-serialization-runtime-js.js")
3) Modified the last line in node_modules/kotlin-compiler/bin/kotlinc in order to enable the the serialization compiler plugin:
${JAVACMD:=java}" $JAVA_OPTS "${java_args[#]}" -cp "${kotlin_app[#]}" "${kotlin_args[#]}" -Xplugin=$KOTLIN_HOME/lib/kotlinx-serialization-compiler-plugin.jar
The thing is that when I run the dev server using npm start, it compiles and runs as expected, but when I run npm run build, I got the following error:
Creating an optimized production build...
Failed to compile.
warning: flag is not supported by this version of the compiler: -
Xplugin=/home/Project/archetype-frontend-kotlin/node_modules/kotlin-compiler/lib/kotlinx-serialization-compiler-plugin.jar
npm ERR! code ELIFECYCLE
And of course when I remove the -Xplugin argument, the application is throwing exceptions like this:
Can't locate argument-less serializer for class Pu…h as lists, please provide serializer explicitly.
(There is an issue on GH related to this https://github.com/Kotlin/kotlinx.serialization/issues/278)
Thanks for any help
Okay, I think I managed to make it work.
Here are the steps as I remember them:
as suggested in https://youtrack.jetbrains.com/issue/CRKA-84, did npm eject and added plugin: require.resolve('kotlin-compiler/lib/kotlinx-serialization-compiler-plugin.jar'), to webpack-kotlin-*.js files (after new KotlinWebpackPlugin).
downloaded the compiled runtime from maven (https://dl.bintray.com/kotlin/kotlinx/org/jetbrains/kotlinx/kotlinx-serialization-runtime-js/0.9.0/) and unpacked it to node-modules/kotlinx-serialization-runtime-js
hacked kotlin-compiler.js by adding the library path (there must be a better way!):
options.libraries.join(isWindows ? ';' : ':') + ":<absolute_path_to_project>/node_modules/kotlinx-serialization-runtime-js/kotlinx-serialization-runtime-js.meta.js"
copied kotlinx-serialization-runtime-js.js and kotlinx-serialization-runtime-js.js.map to node-modules/.cache/kotlin-webpack.
After this yarn start appears to be able to compile some test code that uses kotlinx-serialization, however, Idea fails to find where kotlinx.serialization module comes from.
I hope this answer inspires someone who is willing to reverse-engieer this build system to make a better fix.

Uncaught Error: Module did not self-register

I try to use node-vlc with nw.js (v0.12.0-alpha2). When i launch my app without nw.js it works, but when i launch it with nw.js i got an error:
Uncaught Error: Module did not self-register.", source: /home/alexis/Bureau/dev/jukebox/node_modules/vlc/node_modules/ffi/node_modules/bindings/bindings.js (84)
I tried some commands with nw-gyp but it couldn't help me.
I am on Ubuntu 14, 64-bit.
If you've upgraded node then npm rebuild might fix this for you
For me:
rm -r node_modules then
npm install
I had a similar issue with another product and my fix was to change the version of node I was using. I was using 0.12.0 and changed back to 0.10.26.
Personally, I use NVM to handle node version changing. With NVM installed it's as simple as running
nvm use 0.10.26
Or setting the default version to 0.10.26
nvm alias default 0.10.26
Hopefully this helps you out - our issues came from different products but the solution may be the same.
I had similar problem.
/Users/user/NodeAddons/bridge/node_modules/bindings/bindings.js:83
Error: Module did not self-register.
In my case I was doing a C/C++ Add-on, and I had forgotten to export the add-on, in my main.cc was missing the code below:
void Init(v8::Handle<v8::Object> exports) {
NODE_SET_METHOD(exports, "method", method);
}
NODE_MODULE(method, Init);
Hope this helps others!
Thanks :)
I've add the same issue because I installed to modules as sudo...
Removing the node modules folder and reinstalling as normal user fixed it.
For me npm rebuild or npm update didn't work. I had to remove the node_modules folder and run npm install to install them again.
I once had this problem when creating a multi-file c++ addon. In my binding.gyp file I had:
"sources": ["src/*.cc", "src/*.h" ]
And my project contained several *.cc files. However, the NODE_MODULE() macro was called only on one file which imported the rest of the files. But node expects that it is called on the frist *.cc file listed in sources. So I had to change sources to explicitly add that file to the beginning
For me, running npm update worked
I was getting an internal error: Module did not self-register.
Deleted the node_modules folder
ran npm install
It worked just fine.
I had this error with Snappy. Was using Node 11. Checked Snappy's NPM page https://www.npmjs.com/package/snappy where they listed which versions of node they supported.
Deleting node_modules folder rm -rf node_modules and then reinstalling using the correct version of Node resolved it.
One of the versions they supported on Linux at the time of this writing was Node version 12.
nvm deactivate 11
nvm uninstall 11
nvm install 12
nvm use 12
Problem solved
Another cause of this problem: if you're using pm2, then after upgrading node you may need to reinstall pm2. Test whether pm2 is the issue by running your app
without pm2 node server.js
then with pm2: pm2 start server.js.
Proper way to update PM2 after updating Node.js
I had this same issue with 0.12 and io.js 1.3.0, reverting to Node.js 0.10 fixed the issue.
Rebuild your C++ add-ons.
Did you encounter something like this?
Module did not self-register: '…\node_modules\#u4\opencv4nodejs\build\Release\opencv4nodejs.node
It’s likely that you have just updated your Node.js. Once you updated your Node.js, you need to rebuild your C++ add-ons, Node.js packages written in C++.
Why
When you build Node.js’ C++ add-ons, they get compiled into require-able .node files and linked to the currently installed Node.js ABI library, which is not compatible with other versions of it. Your packages were built only compatible with the specific version of Node.js.
How
Firstly, try npm rebuild. If your C++-add-on-based packages have a build script, it’ll do. If it doesn’t, you need to manually build your C++ native add-on packages. Do again what you did when you were installing such packages. Refer to the building instructions in the packages’ documentations to rebuild them. Or try reinstalling (npm install) them.
I had the same problem. My script that was referencing a global reference script had an invalid reference. I took off that invalid reference and the error was gone. My error message had no indication of that particular invalid reference which made it harder to debug. But 'Uncaught Error: Module did not self-register' was the message I was getting.
This also happen in my other project. For some reason, it wouldn't recognize the reference path if one of the characters are uppercase. Even thought, the upper-casing was the correct spelling of the path.
I had this issue while setting up my Cypress project.
I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', to tell cypress explicitly to use the node version installed on my machine.
Add this line to your settings file:
**"nodeVersion": "system"**

LiveScript with Meteor.js

I wonder if there is an easy way to get LiveScript files compiled to js in Meteor.js app. Found this mrt extension:
https://atmosphere.meteor.com/package/livescript-latest
But doing mrt add livescript-latest only gives error:
While building package `livescript-latest`:
package.js:3:9: Package.register_extension() is no longer supported. Use Package._transitional_registerBuildPlugin instead.
In the git repo of this extension the error is already fixed. So I can this directly to smart.json:
"livescript-latest": {
"git": "https://github.com/Whoaa512/meteor-livescript.git",
"branch": "master"
}
This seems to be installed fine, but when I try adding .ls files to the project, they are not seems to be compiled.
Anyone else tried LiveScripting with Meteor.js apps?
Try using the other livescript package. I'm not sure why someone created the livescript-latest package - both seem to be using version 1.2.0 of livescript.
mrt add livescript
This worked for me back when I was using LiveScript.
meteor add vasaka:livescript-compiler
https://atmospherejs.com/vasaka/livescript-compiler

Node.js / npm - anyway to tell if a package is pure JS or not?

I've noticed that in trying to get seemingly simple node packages to install with npm (e.g. nerve, a "micro-framework") I often run into some form of dependency pain. After some digging, I tracked down the problem with nerve to the bcrypt module, which is apparently written in C/C++ and has to be compiled after the package manager downloads it.
Unfortunately, it seems like if you want this to work on Windows, the answer is (from one of the bcrypt issues threads) "install a Linux VM". So earlier today I did just that, and started running into other dependencies (you need certain unnamed apt packages installed before you can even think about building, despite GCC being installed), then eventually after seeing yet another C compiler error (about some package or other not being able to find "Arrays.c" I think), I actually gave up, and switched from nerve to express instead. Ironically, the larger and more complicated express installs with npm on Linux and Windows without a single issue.
So, my question is: is there any filter / dependency tracking available that lets you see if a package has additional dependencies besides node core? Because to me the allure of node is "everything in Javascript", and this kind of stuff dispels the illusion quite unpleasantly. In fact, despite having done more than my time working with C/C++, whenever I see a requirement to "make" something these days I generally run in the other direction screaming. :)
The first solution doesn't tell you if a dependency makes the package impure or not. Much better to search for gyp generated output:
find node_modules/ | grep binding.gyp || echo pure
Look out for the "scripts" field in the package.json.
If it contains something like
"scripts": {
"install": "make build",
}
and a Makefile in the root directory, there's a good possibility that the package has some native module which would have to be compiled and built. Many packages include a Makefile only to compile tests.
This check on the package documents does not exclude the possibility that some dependency will have to be compiled and built. That would mean repeating this process for each dependency in the package.json, their dependencies and so on.
That said many modules have been updated to install, without build on Windows, express for one. However that cannot be assured of all packages.
Using a Linux VM seems to be the best alternative. Developing Node.js applications on Window gives you step by step instructions on installing a VM, Node.js and Express.
Node is not "everything javascript" , since one way to extend node core is to write c/c++ plugins.
So Node is more a javascript wrapper around c/c++ modules using V8.
How could you write efficient database drivers in pure javascript for instance ? it would be possible but slow.
as for the filters , it is up to the author to document his package. there is no automatic filter.

Categories