Project's gulp should run with Node.js 10 version
- Since gulp needs to run with the old version of node, errors will not occur.
- I fixed node version to 10 in this project.
- gulp is installed globally and within this project.
- After running gulp, the node version number used will be printed. You can see that if you do not use --node to explicitly specify the version number, the global version 20 will be used.
If gulp is installed in the project, the gulp version in the project should be used first, and the same is true for node.
When using a globally installed package from volta which gulp should not be resolving to cocos-service-pack/src/node_modules/.bin/gulp, it should be found at ~/.volta/bin/gulp.
Some questions to figure out what is going on here:
- Can you run
~/.volta/bin/gulp tttt? - How did you install gulp globally (what command did you run)?
- Can you
echo $PATHfromcocos-service-pack/src/engine? - Can you run
which -a gulpfromcocos-service-pack/src/engine? - What are you using to add
node_modules/.binto your$PATH? Normally from within a repo, you cannotwhich fooand have it resolved from./node_modules/.bin/, so it seems that something is adding./node_modules/.binto$PATH.
@rwjblue
- Can run normally, version is
v22.11.0 - I run
npm i -g [email protected] - PATH:
/Users/smallmain/.console-ninja/.bin:/Library/Frameworks/Python.framework/Versions/3.13/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Users/smallmain/.bun/bin:/Users/smallmain/.volta/bin - The result is:
/Users/smallmain/.volta/bin/gulp - I didn't add it, the command I ran was
volta which gulpand what it returned was/Users/smallmain/Documents/Work/cocos-service-pack-src/engine/node_modules/.bin/gulp
If the correct behavior is to execute the globally installed gulp no matter what, how do I solve this problem when a project relies on older versions of gulp and node ?
If the correct behavior is to execute the globally installed gulp no matter what
This is not the correct behavior. Take a look at this blog post that explains how Volta works RE: globals:
https://blog.volta.sh/2019/06/18/global-installs-done-right/
If the correct behavior is to execute the globally installed gulp no matter what
This is not the correct behavior. Take a look at this blog post that explains how Volta works RE: globals:
https://blog.volta.sh/2019/06/18/global-installs-done-right/
Alright, so now it's indeed running correctly in the gulp project, but Node is not using the locked version of Node specified in the project.
Probably the best thing to debug this further is to make a new temp / sandbox project and start porting things over until you can replicate the issue. That should help narrow things down for you a bunch.