Comments (7)
@alexfederlin I don't have Windows, so it's a bit hard for me to test it.
Could you kindly try now? I've already updated on npm also.
from cordova-import-npm.
Great that it worked
But now try to edit the file npmFilesToImport.json
according to instructions and then run cordova prepare
If anything fails, please let me know such that I fix it.
Thanks for reporting the bug
from cordova-import-npm.
it appears process.env.INIT_CWD
is undefined on your side, since it's breaking on this line.
Can you try to test by doing console.log(process.env.INIT_CWD)
and check the output?
Anyway I was checking and it seems to be a bug with node on Windows, which may be solved with this npm package.
I'll try to fix it ASAP
from cordova-import-npm.
You are right, INIT_CWD is undefined:
λ node
Welcome to Node.js v14.17.1.
Type ".help" for more information.
> console.log(process.env.INIT_CWD)
undefined
undefined
When I tab complete, the following options come up:
> console.log(process.env.
process.env.__defineGetter__ process.env.__defineSetter__
process.env.__lookupGetter__ process.env.__lookupSetter__
process.env.__proto__ process.env.hasOwnProperty
process.env.isPrototypeOf process.env.propertyIsEnumerable
process.env.toLocaleString process.env.toString
process.env.valueOf
process.env.constructor
process.env.ALLUSERSPROFILE process.env.ANDROID_SDK_ROOT
process.env.APPDATA process.env.COMPUTERNAME
process.env.ChocolateyInstall process.env.ChocolateyLastPathUpdate
process.env.ComSpec process.env.CommonProgramFiles
process.env.CommonProgramW6432 process.env.DriverData
process.env.EMAIL process.env.FPS_BROWSER_APP_PROFILE_STRING
process.env.FPS_BROWSER_USER_PROFILE_STRING process.env.HOMEDRIVE
process.env.HOMEPATH process.env.INTEL_DEV_REDIST
process.env.JAVA_HOME process.env.JD2_HOME
process.env.LOCALAPPDATA process.env.LOGONSERVER
process.env.MIC_LD_LIBRARY_PATH process.env.NUMBER_OF_PROCESSORS
process.env.OS process.env.OneDrive
process.env.OneDriveConsumer process.env.PATHEXT
process.env.PROCESSOR_ARCHITECTURE process.env.PROCESSOR_IDENTIFIER
process.env.PROCESSOR_LEVEL process.env.PROCESSOR_REVISION
process.env.PROMPT process.env.PSModulePath
process.env.PUBLIC process.env.Path
process.env.ProgramData process.env.ProgramFiles
process.env.ProgramW6432 process.env.SESSIONNAME
process.env.SystemDrive process.env.SystemRoot
process.env.TEMP process.env.TMP
process.env.USERDOMAIN process.env.USERDOMAIN_ROAMINGPROFILE
process.env.USERNAME process.env.USERPROFILE
process.env.windir
> console.log(process.env.
To make sure I started again from scratch with the new version:
λ cordova create . com.test test
Creating a new cordova project.
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (com.test)
version: (1.0.0)
git repository:
license: (Apache-2.0)
About to write to D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\package.json:
{
"name": "com.test",
"displayName": "test",
"version": "1.0.0",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ecosystem:cordova"
],
"author": "Apache Cordova Team",
"license": "Apache-2.0",
"devDependencies": {
"cordova-plugin-whitelist": "^1.3.4"
},
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {}
}
}
}
Is this OK? (yes)
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npm install cordova-import-npm
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
+ [email protected]
added 10 packages from 53 contributors and audited 10 packages in 3.128s
found 0 vulnerabilities
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npx setup-cordova-import-npm
Setup script called from undefined
Editing config.xml:D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\config.xml
No hooks in root widget of config.xml, adding new one:
<hook src="node_modules/cordova-import-npm/scripts/importNpmPackages.js" type="before_prepare"/>
config.xml edited with success
events.js:352
throw er; // Unhandled 'error' event
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at Object.join (path.js:424:7)
at createnJsonFile (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\cordova-import-npm\scripts\setupCordovaImportNpm.js:79:25)
at D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\cordova-import-npm\scripts\setupCordovaImportNpm.js:73:3
at Parser.<anonymous> (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\xml2js\lib\parser.js:304:18)
at Parser.emit (events.js:375:28)
at SAXParser.onclosetag (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\xml2js\lib\parser.js:262:26)
at emit (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\sax\lib\sax.js:624:35)
at emitNode (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\sax\lib\sax.js:629:5)
at closeTag (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\sax\lib\sax.js:889:7)
Emitted 'error' event on Parser instance at:
at Parser.exports.Parser.Parser.parseString (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\xml2js\lib\parser.js:327:16)
at Parser.parseString (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\xml2js\lib\parser.js:5:59)
at Object.<anonymous> (D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\cordova-import-npm\scripts\setupCordovaImportNpm.js:29:8)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
from cordova-import-npm.
@alexfederlin I had missed some issues, I already updated npm, can you kindly test again now (from scratch)?
As said I have no Windows, thus I have to rely on you to help me :)
Thanks
from cordova-import-npm.
Well thank YOU for fixing my issue ;-)
This looks pretty good!
Not sure why I had to run npm twice again, here's the logfile and the output
2021-07-02T06_34_10_775Z-debug.log
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin)
λ ls -la
total 16
drwxr-xr-x 1 alex 197121 0 Jul 2 08:33 ./
drwxr-xr-x 1 alex 197121 0 Jul 1 21:55 ../
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin)
λ cordova create . com.test test
Creating a new cordova project.
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (com.test)
version: (1.0.0)
git repository:
license: (Apache-2.0)
About to write to D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\package.json:
{
"name": "com.test",
"displayName": "test",
"version": "1.0.0",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ecosystem:cordova"
],
"author": "Apache Cordova Team",
"license": "Apache-2.0",
"devDependencies": {
"cordova-plugin-whitelist": "^1.3.4"
},
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {}
}
}
}
Is this OK? (yes)
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npm install cordova-import-npm
npm WARN [email protected] No repository field.
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\universalify
npm ERR! dest D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\.universalify.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\universalify' -> 'D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\node_modules\.universalify.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\alex\AppData\Roaming\npm-cache\_logs\2021-07-02T06_34_10_775Z-debug.log
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npm install cordova-import-npm
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
+ [email protected]
added 7 packages from 52 contributors and audited 10 packages in 0.864s
found 0 vulnerabilities
D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test (master -> origin) ([email protected])
λ npx setup-cordova-import-npm
Setup script called from D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test
Editing config.xml:D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\config.xml
No hooks in root widget of config.xml, adding new one:
<hook src="node_modules/cordova-import-npm/scripts/importNpmPackages.js" type="before_prepare"/>
config.xml edited with success
Empty file D:\alex\Dropbox\Dropbox\Projects\phonegap\BeginningNFC\test\npmFilesToImport.json created
For syntax on this file check: https://github.com/jfoclpf/cordova-import-npm
Thanks again. I think this can now be closed...
from cordova-import-npm.
BTW, I suppose that you must always run npm install
after you create the cordova project, that's why you needed to run twice.
from cordova-import-npm.
Related Issues (2)
- Universal slashes HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-import-npm.