React Native new init app not able to run via xcode or via npm run ios.
System - Mac
Npm - 6.14.12
node - v14.16.1
react-native - 2.0.1
>>>>> Generating schema from flow types
/Users/admin/Documents/ios/MyProject/node_modules/react-native-codegen/lib/parsers/flow/index.js:220
const regex = new RegExp(TURBO_MODULE_REGISTRY_REQUIRE_REGEX_STRING, 'g');
^
SyntaxError: Invalid regular expression: /TurboModuleRegistry\s*\.\s*get(Enforcing)?\s*<\s*Spec\s*>\s*\(\s*['"](?<nativeModuleName>[A-Za-z$_0-9]+)['"]\s*,?\s*\)/: Invalid group
at new RegExp (<anonymous>)
at buildSchema (/Users/admin/Documents/ios/MyProject/node_modules/react-native-codegen/lib/parsers/flow/index.js:220:19)
at Object.parseFile (/Users/admin/Documents/ios/MyProject/node_modules/react-native-codegen/lib/parsers/flow/index.js:276:10)
at files.reduce (/Users/admin/Documents/ios/MyProject/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:75:35)
at Array.reduce (<anonymous>)
at combineSchemas (/Users/admin/Documents/ios/MyProject/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:66:16)
at Object.<anonymous> (/Users/admin/Documents/ios/MyProject/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:90:40)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
Command PhaseScriptExecution failed with a nonzero exit code
This was an issue where the react-native-codegen reference in react-native was set to v0.0.6. In the newer 0.0.7 version a lot changed in the parser. It looks like back in February of 2021 the reference was updated to 0.0.7 which is also a part of react-native#0.65.0.
If you check out the package.json file in the react-native package I am guessing it is referencing the 0.0.6 version of the codegen package. You could update react-native (I see you referenced it as 2.0.1 in your post, but check the package.json file in the react-native folder to see what you have). You can also add the new version of codegen like this:
npm install --save-dev react-native-codegen#0.0.7
I recommend updating react-native if you can, but the codegen package update just in the root package.json also works for now.
Related
I'm trying to run npm run gulp and I'm coming up with this primordials is not defined error (I have also added the npm-shrinkwrap.json file as suggested which gets updated after running npm install but it doesn't fix my primordials is not define error):
> gulp-tutorial#1.0.0 gulp
> gulp
fs.js:47
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:47:5
at req_ (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:143:24)
at Object.req [as require] (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
Node.js v17.0.1
Any suggestions 🙌 ?
Primordials are used by Node.js internal modules and are not accessible to end user scripts. (That's their entire point for existing. Otherwise, you could modify Object.prototype and end up affecting Node.js internals, causing weird crashes and things like that.)
The module that is giving you this error is the natives module. The page for the package says:
This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs#4.x.
Sounds like it's at that point where it's broken. Use npm ls natives to find out what's using it. (You might need to be in the /Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main directory when you run the command.) From there, you can try to figure out how to get rid of it.
Another possibility would be to try downgrading to an earlier version of Node.js to see if it works with that version.
The problem was with the versions not matching up. I also had 2 NodeJS installation paths and that was throwing things off.
I uninstalled them all, started from the beginning and used brew to reinstall.
Then checked that the versions were all compatible.
I also had to install node-sass and referred to this compatibility table to get the correct version - https://github.com/sass/node-sass#node-version-support-policy
Now its working and I can get on developing :) As of today Im running Node v17.0.1 Npm v8.1.0 Gulp cli v2.3.0
My problem is that I want to import this library on a desktop app based on NW.js (the template is here).
import Cap from 'cap-rbfork' //set on a vue.js view
When I start the app, it doesn't load the page and I get this error on the window console:
VM245:11 Uncaught Error: The module '/home/user/app/node_modules/cap-rbfork/build/Release/cap.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`). Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (:9080/internal/modules/cjs/loader.js:955)
at Module.load (:9080/internal/modules/cjs/loader.js:756)
at Function.Module._load (:9080/internal/modules/cjs/loader.js:669)
at Module.require (:9080/internal/modules/cjs/loader.js:796)
at require (:9080/internal/modules/cjs/helpers.js:68)
at Object.<anonymous> (:9080/home/user/app/node_modules/cap-rbfork/lib/Cap.js:3)
at Module._compile (:9080/internal/modules/cjs/loader.js:893)
at Object.Module._extensions..js (:9080/internal/modules/cjs/loader.js:910)
at Module.load (:9080/internal/modules/cjs/loader.js:756)
at Function.Module._load (:9080/internal/modules/cjs/loader.js:669)
#Jaredcheeda
I followed your instructions, and I created a new NWjs app with the template you suggested.
mounted(){
var Cap = this.nw.require('cap-rbfork')
console.log(Cap) //it lists properties
console.log(Cap.Cap.deviceList()) //or Cap.deviceList(), but the app crashes anyway, without reporting the reason, except SIGSEGV
}
If I visit the page from the browser, I get this error:
vue.runtime.esm.js?2b0e:1897 Error: Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
at eval (cap.node:1)
at Object../node_modules/cap-rbfork/build/Release/cap.node (chunk-vendors.js:22)
at __webpack_require__ (app.js:849)
at fn (app.js:151)
at eval (Cap.js?c745:3)
at Object../node_modules/cap-rbfork/lib/Cap.js (chunk-vendors.js:33)
at __webpack_require__ (app.js:849)
at fn (app.js:151)
at VueComponent.mounted (App.vue?234e:37)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1863)
I don't know this means that NW needs to be downgraded, so it can match the correct node-gyp version. I created an Electron project, and following this answer to a similar problem, it worked. Is there a NW equivalent to electron-rebuild?
Completely uninstall your globally installed version of Node
Install a Node Version Manager:
Linux/OSX - https://github.com/nvm-sh/nvm
Windows 8+ - https://github.com/coreybutler/nvm-windows
Windows 7 - https://github.com/nullivex/nodist
Check the version of Node that is built in to NW.js
https://nwjs.io/versions.json
or console.log(process.versions); in NW.js
Use your nvm tool of choice to install and switch to the matching Node version
Delete the package-lock.json and node_modules folder
Do npm install this will download/build files specific to your global Node versions, which should match the version built in to NW.js
With all that said, Vue-CLI's Webpack/Babel set up is designed to import/bundle/tree-shake BROWSER code, not NODE code. So doing import x from 'y' won't work if it involves native code, node-bindings, executables, or Node specific code.
NW.js uses require instead of import to handle importing Node modules.
See: NW-Vue-CLI-Example
You may also need to change your NW.js version if you are having issues with Node-GYP/NW-GYP:
See: https://dev.to/thejaredwilcurt/guide-to-nw-js-versions-5d38#0392-20190627
Getting an error when creating a Foundation Zurb project. Tried to solve using the previous suggestions shown for other applications, but none are working.
A post referenced updating elm, and I did so, however, it did not work. Additionally, I reviewed the closed issue for Gulp 3 (i am using gulp 4), but there was not viable fixes (Gulp 3 is broken on Node 12 #2324) or workarounds.
$ foundation new --framework emails
fs.js:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at fs.js:27:26
at req_ (/usr/lib/node_modules/foundation-cli/node_modules/natives/index.js:143:24)
at Object.req [as require] (/usr/lib/node_modules/foundation-cli/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/usr/lib/node_modules/foundation-cli/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
I expect the project to build.
I guess you use NodeJS 12 or newer.
NodeJS 12 (and newer) is (currenctly) not supported by the current CLI. Please use NodeJS 10.
You can switch to NodeJS 10 using nvm, n, nodenv or any other solution for managing NodeJS versions.
primordials is part of the natives package and called in the graceful-fs package as you can see in the stacktrace.
You can try to upgrade the graceful-fs dependency from 3 to 4 but this might not work without other changes.
This is in fs.js of graceful-fs 3:
module.exports = require('natives').require('fs', ['stream'])
From the natives page on npmjs.com:
This package has been deprecated
Author message:
This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs#4.x.
Also see https://travis-ci.com/DanielRuf/foundation-cli-test/builds/112738932
Compare this to the environment where we have NodeJS 10 (the team of gulp has deleted the 4.0 tag, you can change the line in package.json to reference gulp 4.0.0):
Works for me using the
Manual Setup (node v13.7.0)
To manually set up the template, first download it with Git:
git clone https://github.com/zurb/foundation-emails-template "projectname"
Then open the folder in your command line, and install the needed dependencies:
cd projectname
npm install
I am creating a panel in Adobe Premiere Pro which used Google Cloud speech. I am accessing google-cloud/speech on the Javascript side, not JSX side via NodeJS. I am also accessing google-cloud/storage. No big deal, I installed NodeJS on a Mac and functions accessing google-cloud/storage were easy to code.
After following the instructions to npm --save #google-cloud/speech and npm --save #google-cloud/storage, it created the node_modules directory. I have moved them to a custom directory but they are duplicated in the standard location also.
In my code, I reference them as per the google-cloud examples:
// note cep.node is required in the Adobe CEP environment to access nodejs
const speech = cep_node.require(extention_path+'/lib/node_modules/#google-cloud/speech');
const project_id ='project_id_xxx1234';
const keyFilePath = extention_path +'/path/to/key.json';
const client = new speech.v1.SpeechClient({
projectId: project_id,
keyFilename: keyFilePath,
});
I've tried this w/o the ids and speech.SpeechClient() etc as per examples. The methodology is working fine with google-cloud/storage, so I know the similar downloaded node modules at the same location work fine for that.
However, it fails on trying to make a new speech.SpeechClient() with the browser debug error below.
Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v51-darwin-x64-unknown
Found: [.DS_Store, node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v51-darwin-x64-unknown/grpc_node.node'
at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/grpc_extension.js:53:17)
at Module._compile (module.js:595:32)
at Object.Module._extensions..js (module.js:610:10)
at Module.load (module.js:512:32)
at tryModuleLoad (module.js:471:12)
at Function.Module._load (module.js:463:3)
at Module.require (module.js:522:17)
at require (internal/module.js:20:19)
at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/client_interceptors.js:145:12)
at Module._compile (module.js:595:32)
My belief is that these series of node_modules that are accessed by #google-cloud/speech were compiled use NODE_MODULE_64 and need 51 (instead).
$ npm rebuild rebuilds (or checks current version of the modules) fine with the exception
protobufjs#6.8.8 postinstall /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/protobufjs
node scripts/postinstall
grpc#1.14.1 install /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
[grpc] Success: "/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
So some module needs v51 instead of the build v64. The question is can the #google-cloud/speech modules be built using v51 and how? or do I wait for google-cloud to come up with a solution? BTW: I also renamed the node-v64 dir to node-51, but received another error referencing the MODULE 51. Any direction would be appreciated.
Some of the dependencies for #google-cloud/speech are native addons. Those being C/C++ code, they need to be compiled for the correct Node version. Looks like your Node version that you used for npm install doesn't match the one in Adobe CEP. Switch to Node 5.1 and run npm install or npm rebuild again.
I recommend using nvm to change Node versions, see Node Version Manager.
After upgrading to Ember cli 2.12.1 I receive the following error, when trying to serve ember.
Cannot find module 'C:\Users\assaue\web\client\bower_components\ember\ember-template-compiler'
Error: Cannot find module 'C:\Users\assaue\web\client\bower_components\ember\ember-template-compiler'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Class.htmlbarsOptions (C:\Users\assaue\web\client\node_modules\emberx-file-input\node_modules\ember-cli-htmlbars\ember-addon-main.js:72:25)
at Object.toTree (C:\Users\assaue\web\client\node_modules\emberx-file-input\node_modules\ember-cli-htmlbars\ember-addon-main.js:31:43)
at C:\Users\assaue\web\client\node_modules\ember-cli-preprocess-registry\preprocessors.js:180:26
at Array.forEach (native)
at processPlugins (C:\Users\assaue\web\client\node_modules\ember-cli-preprocess-registry\preprocessors.js:178:11)
at module.exports.preprocessTemplates (C:\Users\assaue\web\client\node_modules\ember-cli-preprocess-registry\preprocessors.js:161:10)
Try updating below in package.json
"ember-cli-htmlbars-inline-precompile": "^0.3.6"
Maybe any one of your addons might expect ember to be installed through bower.
I think some of your addon listed in package.json requires ember js to be in bower directory. For my app, the addon was jquery-ui and it was referred as following.
templateCompilerPath = this.project.bowerDirectory + '/ember/ember-template-compiler';
Add
"ember": "2.13.0" ( Latest Version now )
in bower.json
Ember has moved ember package from bower to npm as ember-source, but still it doesn't work as expected because of third party addons
when you don't have ember package in bower.json.
You may get WARNING: Ember.js is now provided by node_moduleember-source, please remove it from bower in terminal when you run your ember app.
I am pretty sure that the problem is in the emberx-file-input module judging from your log.
at Class.htmlbarsOptions (C:\Users\assaue\web\client\node_modules\emberx-file-input\node_modules\ember-cli-htmlbars\ember-addon-main.js:72:25)
Key fragment is \emberx-file-input\node_modules\ember-cli-htmlbars
It doesn't have the correct ember-cli-htmlbars yet and hence it throws the error. Try to find the version of the emberx-file-input which has the correct dependency.