-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
srcP.startsWith is not a function when adding --up #94
Comments
hm weird possibly related to some stuff involving home directories on
windows machines I'll take a look on monday
…On Fri, Nov 6, 2020 at 8:35 PM kokoshneta ***@***.***> wrote:
I rarely work with Node/NPM and have only just found this package now, so
consider me brand new. I’m working on a Windows 2012 R2 Server.
I’ve managed to get node run copyfiles path/to/input/file.ext output/path
on its own to work and copy the files as expected. But if I try to go up,
regardless of whether I use -u or --up and regardless of how many levels,
I get the error that srcP.startsWith is not a function. For example, if
I’m in my project folder and do the following:
C:\inetpub\vhosts\project> node run copyfiles -u 4 node_modules/library/input/path/css/*.css dist/styles
– then I get the following error message:
> ***@***.*** copyfiles C:\inetpub\vhosts\project
> copyfiles "4" "node_modules/library/input/path/css/*.css" "styles"
C:\inetpub\vhosts\project\node_modules\copyfiles\index.js:94
toStream(input.map(function(srcP) {return srcP.startsWith('~') ? untildify(srcP) : srcP;}))
^
TypeError: srcP.startsWith is not a function
at C:\inetpub\vhosts\project\node_modules\copyfiles\index.js:94:50
at Array.map (<anonymous>)
at copyFiles (C:\inetpub\vhosts\project\node_modules\copyfiles\index.js:94:18)
at Object.<anonymous> (C:\inetpub\vhosts\project\node_modules\copyfiles\copyfiles:40:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
At first blush, that looks to me like it’s treating the number 4 as a file
name (the -u having apparently disappeared?) but recognising it’s an
integer, converts it, and then logically enough cannot find startsWith(),
which is a string function.
But is that right? And if so, why? I must be missing some step in getting
this to work, but I have no idea which, or where…
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#94>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAITRH5PRMFX5F4ZEMQHJFDSOSP47ANCNFSM4TNKOXXQ>
.
--
-Calvin W. Metcalf
|
just quckly, are you actually running it with |
I’m running with Will try with |
ok so what does the copyfiles script in your package.json look like? |
Just tried with NPX which failed too. Apart from some notifications telling me things like
Note the incorrect path looking for As for my
(As you may have surmised, I’m primarily wanting to use |
why don't you try putting the whole copyfiles command into the
package.json, including the -u 4
…On Mon, Nov 9, 2020 at 2:06 PM kokoshneta ***@***.***> wrote:
Just tried with NPX which failed too. Apart from some notifications
telling me things like Found & ignored ./node_modules ; is listed in
.gitignore, it gave me this:
Starting: copyfiles --up 1 ***@***.***/fontawesome-pro/css/*.css ../styles/fa
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'C:\inetpub\vhosts\project\copyfiles'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Note the incorrect path looking for copyfiles directly in the project
folder instead of the node_modules folder. This may well just be
something to do with my NPX setup, though – I did set it up for something
ages ago, but I don’t remember how or for what, and I never actively use it.
As for my package.json, this is it in its entirety:
{
"private": true,
"name": "project",
"version": "0.0.1",
"scripts": {
"postinstall": "npm run copyfiles css/*.css webfonts ./../styles/fa",
"copyfiles": "copyfiles"
},
"dependencies": {
"postinstall": "*",
"copyfiles": "latest",
***@***.***/fontawesome-pro": "latest"
}
}
(As you may have surmised, I’m primarily wanting to use copyfiles to
automatically copy CSS and webfont files over to the right folders whenever
I update Font Awesome through NPM.)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#94 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAITRH7NR5EENRNTH7WDBHLSPA4TZANCNFSM4TNKOXXQ>
.
--
-Calvin W. Metcalf
|
Ah, I hadn’t actually tried that yet – I wanted to make sure I had the parameters right in the command line first before ‘committing’ it to automation. I’ll try adding it and see if that might work. |
So I modified the
Doing
The two error logs noted don’t tell me an awful lot more offhand, but they probably give you more info than me, so they’re attached here: log-606Z.log, log-526Z.log. |
change that to
npm automatically puts scripts into the path when you run it like that |
That did it! Had to change the second input to |
I rarely work with Node/NPM and have only just found this package now, so consider me brand new. I’m working on a Windows 2012 R2 Server.
I’ve managed to get
node run copyfiles path/to/input/file.ext output/path
on its own to work and copy the files as expected. But if I try to go up, regardless of whether I use-u
or--up
and regardless of how many levels, I get the error thatsrcP.startsWith is not a function
. For example, if I’m in my project folder and do the following:– then I get the following error message:
At first blush, that looks to me like it’s treating the number 4 as a file name (the
-u
having apparently disappeared?) but recognising it’s an integer, converts it, and then logically enough cannot findstartsWith()
, which is a string function.But is that right? And if so, why? I must be missing some step in getting this to work, but I have no idea which, or where…
The text was updated successfully, but these errors were encountered: