JaneaSystems / nodejs-mobile-samples

Repository for demo applications that use Node.js on Mobile
MIT License
168 stars 111 forks source link

Cannot find module 'left-pad' #16

Open chenyun120 opened 5 years ago

chenyun120 commented 5 years ago

native-xcode-node-folder[42936:134173] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform. module.js:529 throw err; ^

Error: Cannot find module 'left-pad' at Module._resolveFilename (module.js:529:5) at Module._load (module.js:476:5) at Module.prototype.require (module.js:568:3) at require (internal/module.js:11:7) at Anonymous function (/Users/CY/Library/Developer/CoreSimulator/Devices/986FC198-291E-496F-B81D-7E79E54F24DA/data/Containers/Bundle/Application/9950C232-5EE1-4454-A641-8C5AF820E751/native-xcode-node-folder.app/nodejs-project/main.js:2:1) at Module.prototype._compile (module.js:624:5) at Module._extensions[.js] (module.js:635:3) at Module.prototype.load (module.js:545:3) at tryModuleLoad (module.js:508:5) at Module._load (module.js:500:3)

jaimecbernardo commented 5 years ago

Hi @chenyun120 ,

Looks like left-pad is not available to the run time. Did you run npm install in the "How to Run" instructions?

Run npm install inside ios/native-xcode-node-folder/nodejs-project/.

It should create a node_modules/left-pad directory inside.

bearc0025 commented 8 months ago

I get this same error. I can run the "simple" version of the project fine but when I try with the node module left-pad and require('left-pad'), I get this error.

I've done all of the steps including npm install. left-pad is inside the node_modules directory. The related files are in the Copy Bundle Resources in the Build Phases.

Any help is appreciated. Screenshot 2023-09-07 at 2 15 13 PM