I also tested it with other modules. All have the same issue.
My computer is OSX with High Sierra (but I dont think this is relevant).
Anybody else had issues with node modules?
You are probably using any third party library which already has a folder named node_modules locate that and rename it to something different that should resolve it.
I dont understand what you mean… There are no issues with version 1.5.2 and fails with 1.6+. How is that possible?
And this is a fresh OSX setup in a new computer. I installed Creator today for the fist time.
is this a new project? If yes then i can’t help you much in this regard. If this is a old project in that case try searching a folder node_modules in you project root directory, your project probably contains something named node_modules which is in conflict with cocos creator project itself.
Yeah, confirmed it works with gsap. But it doesnt work with ‘moment’. Try import moment and the following syntax:
import * as moment from “…/…/node_modules/moment”;
And you will see the error (this works just fine in 1.5.2). Not sure if the issue its the modules (tried with moment and eventManager) or the syntax.
So, I found out the issue…thanks to you!!! In 1.5.2 I had to import using this syntax:
import * as moment from “…/…/node_modules/moment”; <— includes path to node_modules folder
But starting on version 1.6 I have to do it without path:
import * as moment from “moment”;
Now it works. So I had the warning because I moved from a previous version. I will update the issue on github. thanks @phero_constructs!!!
We’re using npm modules extensively, and without issue. We are specifically targeting mobile, however we do extensive testing and debugging using both the web browser and the Cocos simulator. We’re currently using v1.6.2 stable, the project is written in TypeScript.
Quickly looking through that plugin script documentation, it looks quite frankly extremely difficult to use. We’re using several libraries that rely on other libraries etc, trying to merge them down into on file may even be impossible.
So, if “node_modules” have been deprecated since 1.3, why is this the first mention of it? I’ve searched through the blog and forum posts and could not find anything. Why are they being deprecated, I can appreciate the engine team not wanting to work on issues that stem from people using an module that isn’t compatible with the creator ecosystem. But that shouldn’t prevent other people from using pure JS modules that don’t rely on the DOM or node APIs in our projects.
I would appreciate any insight the team could provide on this issue.
@jrosich Yes, I saw the deprecation mentioned butI continued using it since it is still working. I would be sad to see node modes go. There are a lot of good libraries there and converting them to plugins would be extra work I’d rather avoid.
I’m still using modules with CC 1.7b8 and I hope to upgrade to 1.7 final without losing this functionality.